From 1da7f240d544d27a1b0610220bf6354f38905618 Mon Sep 17 00:00:00 2001 From: emjshrx Date: Sun, 25 Jun 2023 13:18:25 +0530 Subject: [PATCH] test: add test for estimatesmartfee --- test/node-rpc-test.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/test/node-rpc-test.js b/test/node-rpc-test.js index 823203db3..5e07c9c56 100644 --- a/test/node-rpc-test.js +++ b/test/node-rpc-test.js @@ -425,7 +425,7 @@ describe('RPC', function() { const {genesis} = node.network; let entry = await node.chain.getEntry(genesis.hash.reverse()); - // Get current chain tip and chain height + // Get current chain tip and chain height const chainHeight = node.chain.tip.height + 1; const chainTip = util.revHex(node.chain.tip.hash); @@ -542,16 +542,25 @@ describe('RPC', function() { }); describe('utilities', function() { - // 0-in, 2-out - const rawTX1 = - '0100000000024e61bc00000000001976a914fbdd46898a6d70a682cbd34420cc' + - 'f0b6bb64493788acf67e4929010000001976a9141b002b6fc0f457bf8d092722' + - '510fce9f37f0423b88ac00000000'; - + it('should decoderawtransaction', async () => { + // 0-in, 2-out + const rawTX1 = + '0100000000024e61bc00000000001976a914fbdd46898a6d70a682cbd34420cc' + + 'f0b6bb64493788acf67e4929010000001976a9141b002b6fc0f457bf8d092722' + + '510fce9f37f0423b88ac00000000'; const result = await nclient.execute('decoderawtransaction', [rawTX1]); assert.strictEqual(result.vin.length, 0); assert.strictEqual(result.vout.length, 2); }); + + it('should estimate fee rate', async () => { + const result = await nclient.execute('estimatesmartfee', [6]); + assert.deepStrictEqual(result, { + blocks: 6, + feerate: -1, + }); + }); + }); });