diff options
author | Suhas Daftuar <sdaftuar@gmail.com> | 2018-07-30 10:43:59 -0400 |
---|---|---|
committer | Suhas Daftuar <sdaftuar@gmail.com> | 2018-07-30 12:08:23 -0400 |
commit | a13647b8bd667ca58d8e82682c1d46555dce42c9 (patch) | |
tree | b518b60f7c7fcef790e27b93796810e812539e9d /test | |
parent | 57ec1c97b2d0c0ba6056a43fa4177efc39567ae2 (diff) |
[qa] Add test for too-large wallet output groups
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/wallet_groups.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/functional/wallet_groups.py b/test/functional/wallet_groups.py index 0d27815da0..408e9dfef0 100755 --- a/test/functional/wallet_groups.py +++ b/test/functional/wallet_groups.py @@ -5,6 +5,8 @@ """Test wallet group functionality.""" from test_framework.test_framework import BitcoinTestFramework +from test_framework.mininode import FromHex, ToHex +from test_framework.messages import CTransaction from test_framework.util import ( assert_equal, ) @@ -63,5 +65,29 @@ class WalletGroupTest(BitcoinTestFramework): assert_approx(v[0], 0.2) assert_approx(v[1], 1.3, 0.0001) + # Empty out node2's wallet + self.nodes[2].sendtoaddress(address=self.nodes[0].getnewaddress(), amount=self.nodes[2].getbalance(), subtractfeefromamount=True) + self.sync_all() + self.nodes[0].generate(1) + + # Fill node2's wallet with 10000 outputs corresponding to the same + # scriptPubKey + for i in range(5): + raw_tx = self.nodes[0].createrawtransaction([{"txid":"0"*64, "vout":0}], [{addr2[0]: 0.05}]) + tx = FromHex(CTransaction(), raw_tx) + tx.vin = [] + tx.vout = [tx.vout[0]] * 2000 + funded_tx = self.nodes[0].fundrawtransaction(ToHex(tx)) + signed_tx = self.nodes[0].signrawtransactionwithwallet(funded_tx['hex']) + self.nodes[0].sendrawtransaction(signed_tx['hex']) + self.nodes[0].generate(1) + + self.sync_all() + + # Check that we can create a transaction that only requires ~100 of our + # utxos, without pulling in all outputs and creating a transaction that + # is way too big. + assert self.nodes[2].sendtoaddress(address=addr2[0], amount=5) + if __name__ == '__main__': WalletGroupTest().main () |