@@ -267,6 +267,20 @@ def run_test(self):
267267 assert_equal (self .nodes [2 ].getbalance (), node_2_bal )
268268 node_0_bal = self .check_fee_amount (self .nodes [0 ].getbalance (), node_0_bal + Decimal ('10' ), fee_per_byte , self .get_vsize (self .nodes [2 ].gettransaction (txid )['hex' ]))
269269
270+ # Sendmany 5 BTC to two addresses with subtracting fee from both addresses
271+ a0 = self .nodes [0 ].getnewaddress ()
272+ a1 = self .nodes [0 ].getnewaddress ()
273+ txid = self .nodes [2 ].sendmany (dummy = '' , amounts = {a0 : 5 , a1 : 5 }, subtractfeefrom = [a0 , a1 ])
274+ self .generate (self .nodes [2 ], 1 , sync_fun = lambda : self .sync_all (self .nodes [0 :3 ]))
275+ node_2_bal -= Decimal ('10' )
276+ assert_equal (self .nodes [2 ].getbalance (), node_2_bal )
277+ tx = self .nodes [2 ].gettransaction (txid )
278+ node_0_bal = self .check_fee_amount (self .nodes [0 ].getbalance (), node_0_bal + Decimal ('10' ), fee_per_byte , self .get_vsize (tx ['hex' ]))
279+ assert_equal (self .nodes [0 ].getbalance (), node_0_bal )
280+ expected_bal = Decimal ('5' ) + (tx ['fee' ] / 2 )
281+ assert_equal (self .nodes [0 ].getreceivedbyaddress (a0 ), expected_bal )
282+ assert_equal (self .nodes [0 ].getreceivedbyaddress (a1 ), expected_bal )
283+
270284 self .log .info ("Test sendmany with fee_rate param (explicit fee rate in sat/vB)" )
271285 fee_rate_sat_vb = 2
272286 fee_rate_btc_kvb = fee_rate_sat_vb * 1e3 / 1e8
0 commit comments