From 68594fc0a70c4b16bb62a4e4a63935559fe7891f Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Tue, 26 Nov 2019 20:34:39 -0700 Subject: [PATCH] Fix ethereum adapter zero nonce issue JAvascript "Truthy" of zero keeps us from going down the fork where nonces are set. Use typeof !== 'undefined' instead. Signed-off-by: Danno Ferrin --- packages/caliper-ethereum/lib/ethereum.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/caliper-ethereum/lib/ethereum.js b/packages/caliper-ethereum/lib/ethereum.js index 0f7867ab3..0a9c6a43e 100644 --- a/packages/caliper-ethereum/lib/ethereum.js +++ b/packages/caliper-ethereum/lib/ethereum.js @@ -198,7 +198,7 @@ class Ethereum extends BlockchainInterface { let methodType = 'send'; if (methodCall.isView) { methodType = 'call'; - } else if (context.nonces && context.nonces[context.fromAddress]) { + } else if (context.nonces && (typeof context.nonces[context.fromAddress] !== 'undefined')) { let nonce = context.nonces[context.fromAddress]; context.nonces[context.fromAddress] = nonce + 1; params.nonce = nonce;