mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 15:35:09 +00:00
Add validation if Aval have amount then transfer
This commit is contained in:
parent
94c21eb9bd
commit
5fc79e1651
1 changed files with 3 additions and 1 deletions
|
|
@ -88,7 +88,9 @@ var Chaincode = class {
|
|||
if (typeof amount !== 'number') {
|
||||
throw new Error('Expecting integer value for amount to be transaferred');
|
||||
}
|
||||
|
||||
if (!(Aval > amount)) {
|
||||
throw new Error(util.format('amount in account A must must be greater then amount (%d) but found %d', amount, Aval));
|
||||
}
|
||||
Aval = Aval - amount;
|
||||
Bval = Bval + amount;
|
||||
console.info(util.format('Aval = %d, Bval = %d\n', Aval, Bval));
|
||||
|
|
|
|||
Loading…
Reference in a new issue