File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -524,6 +524,22 @@ def run_test(self):
524524 self .sync_all ()
525525 assert_equal (oldBalance + Decimal ('50.19000000' ), self .nodes [0 ].getbalance ()) #0.19+block reward
526526
527+ #####################################################
528+ # test fundrawtransaction with OP_RETURN and no vin #
529+ #####################################################
530+
531+ rawtx = "0100000000010000000000000000066a047465737400000000"
532+ dec_tx = self .nodes [2 ].decoderawtransaction (rawtx )
533+
534+ assert_equal (len (dec_tx ['vin' ]), 0 )
535+ assert_equal (len (dec_tx ['vout' ]), 1 )
536+
537+ rawtxfund = self .nodes [2 ].fundrawtransaction (rawtx )
538+ dec_tx = self .nodes [2 ].decoderawtransaction (rawtxfund ['hex' ])
539+
540+ assert_greater_than (len (dec_tx ['vin' ]), 0 ) # at least one vin
541+ assert_equal (len (dec_tx ['vout' ]), 2 ) # one change output added
542+
527543
528544if __name__ == '__main__' :
529545 RawTransactionsTest ().main ()
Original file line number Diff line number Diff line change @@ -141,10 +141,13 @@ class CTxOut
141141 // which has units satoshis-per-kilobyte.
142142 // If you'd pay more than 1/3 in fees
143143 // to spend something, then we consider it dust.
144- // A typical txout is 34 bytes big, and will
144+ // A typical spendable txout is 34 bytes big, and will
145145 // need a CTxIn of at least 148 bytes to spend:
146- // so dust is a txout less than 546 satoshis
146+ // so dust is a spendable txout less than 546 satoshis
147147 // with default minRelayTxFee.
148+ if (scriptPubKey.IsUnspendable ())
149+ return 0 ;
150+
148151 size_t nSize = GetSerializeSize (SER_DISK ,0 )+148u ;
149152 return 3 *minRelayTxFee.GetFee (nSize);
150153 }
You can’t perform that action at this time.
0 commit comments