File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -1772,6 +1772,20 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1772
1772
let idx_and_scripts = txouts. iter ( ) . map ( |o| ( o. 0 , o. 1 . script_pubkey . clone ( ) ) ) . collect ( ) ;
1773
1773
self . outputs_to_watch . insert ( txid. clone ( ) , idx_and_scripts) . is_none ( )
1774
1774
} ) ;
1775
+ #[ cfg( test) ]
1776
+ {
1777
+ // If we see a transaction for which we registered outputs previously,
1778
+ // make sure the registered scriptpubkey at the expected index match
1779
+ // the actual transaction output one. We failed this case before #653.
1780
+ for tx in & txn_matched {
1781
+ if let Some ( outputs) = self . get_outputs_to_watch ( ) . get ( & tx. txid ( ) ) {
1782
+ for ( idx, idx_and_script) in outputs. iter ( ) . enumerate ( ) {
1783
+ assert ! ( idx < tx. output. len( ) ) ;
1784
+ assert_eq ! ( tx. output[ idx] . script_pubkey, idx_and_script. 1 ) ;
1785
+ }
1786
+ }
1787
+ }
1788
+ }
1775
1789
watch_outputs
1776
1790
}
1777
1791
You can’t perform that action at this time.
0 commit comments