File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -524,6 +524,22 @@ def run_test(self):
524
524
self .sync_all ()
525
525
assert_equal (oldBalance + Decimal ('50.19000000' ), self .nodes [0 ].getbalance ()) #0.19+block reward
526
526
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
+
527
543
528
544
if __name__ == '__main__' :
529
545
RawTransactionsTest ().main ()
Original file line number Diff line number Diff line change @@ -141,10 +141,13 @@ class CTxOut
141
141
// which has units satoshis-per-kilobyte.
142
142
// If you'd pay more than 1/3 in fees
143
143
// 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
145
145
// 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
147
147
// with default minRelayTxFee.
148
+ if (scriptPubKey.IsUnspendable ())
149
+ return 0 ;
150
+
148
151
size_t nSize = GetSerializeSize (SER_DISK,0 )+148u ;
149
152
return 3 *minRelayTxFee.GetFee (nSize);
150
153
}
You can’t perform that action at this time.
0 commit comments