This succeeds:
- 50 outputs of 1 BTC in the same destination
- Send 10.5 BTC
- 2 groups are used for the inputs, in total there are 20 inputs
def test_destination_groupings(self):
'''
If a destination has more than 10 outputs, exactly 10 outputs should
be used when spending from that destination
'''
self.log.info("Test destination groupings")
new_addr = self.nodes[1].getnewaddress()
ret_addr = self.nodes[0].getnewaddress()
for _ in range(50):
self.nodes[0].sendtoaddress(new_addr, 1)
self.nodes[0].generate(1)
self.sync_all()
txid = self.nodes[1].sendtoaddress(ret_addr, 10.5)
inputs = self.nodes[1].getrawtransaction(txid, 1)["vin"]
assert_equal(len(inputs), 20)
This fails:
- 11 outputs of 1 BTC in the same destination
- Send 10.5 BTC
- Results in
Insufficient funds
def test_destination_groupings(self):
'''
If a destination has more than 10 outputs, exactly 10 outputs should
be used when spending from that destination
'''
self.log.info("Test destination groupings")
new_addr = self.nodes[1].getnewaddress()
ret_addr = self.nodes[0].getnewaddress()
for _ in range(21):
self.nodes[0].sendtoaddress(new_addr, 1)
self.nodes[0].generate(1)
self.sync_all()
txid = self.nodes[1].sendtoaddress(ret_addr, 10.5)
inputs = self.nodes[1].getrawtransaction(txid, 1)["vin"]
assert_equal(len(inputs), 20)