@@ -748,8 +748,11 @@ fn accept_0conf() {
748
748
) ;
749
749
}
750
750
751
- #[ test]
752
- fn ln_transfers ( ) {
751
+ #[ rstest]
752
+ #[ case( false ) ]
753
+ #[ ignore = "fix needed" ] // https://github.com/RGB-WG/rgb-std/issues/292
754
+ #[ case( true ) ]
755
+ fn ln_transfers ( #[ case] update_witnesses_before_htlc : bool ) {
753
756
initialize ( ) ;
754
757
755
758
let mut wlt_1 = get_wallet ( & DescriptorType :: Wpkh ) ;
@@ -787,6 +790,9 @@ fn ln_transfers() {
787
790
let htlc_btc_amt = 4000 ;
788
791
let htlc_derived_addr = wlt_1. get_derived_address ( ) ;
789
792
793
+ // no problem: since there's no htlc for this commitment
794
+ wlt_1. sync_and_update_witnesses ( Some ( pre_funding_height) ) ;
795
+
790
796
println ! ( "\n 2. fake commitment TX (1 HTLC)" ) ;
791
797
let beneficiaries = vec ! [
792
798
( wlt_2. get_address( ) , Some ( 2000 ) ) ,
@@ -811,6 +817,10 @@ fn ln_transfers() {
811
817
wlt_1. consume_fascia ( fascia. clone ( ) , psbt. txid ( ) ) ;
812
818
wlt_1. debug_logs ( contract_id, & iface_type_name, AllocationFilter :: WalletAll ) ;
813
819
820
+ if update_witnesses_before_htlc {
821
+ wlt_1. sync_and_update_witnesses ( Some ( pre_funding_height) ) ;
822
+ }
823
+
814
824
println ! ( "\n 3. fake HTLC TX" ) ;
815
825
let witness_id = fascia. witness_id ( ) ;
816
826
let txid = witness_id. as_reduced_unsafe ( ) ;
@@ -887,6 +897,10 @@ fn ln_transfers() {
887
897
wlt_1. consume_fascia ( fascia. clone ( ) , psbt. txid ( ) ) ;
888
898
wlt_1. debug_logs ( contract_id, & iface_type_name, AllocationFilter :: WalletAll ) ;
889
899
900
+ if update_witnesses_before_htlc {
901
+ wlt_1. sync_and_update_witnesses ( Some ( pre_funding_height) ) ;
902
+ }
903
+
890
904
println ! ( "\n 6. fake HTLC TX" ) ;
891
905
let witness_id = fascia. witness_id ( ) ;
892
906
let txid = witness_id. as_reduced_unsafe ( ) ;
@@ -914,6 +928,9 @@ fn ln_transfers() {
914
928
wlt_1. consume_fascia ( fascia. clone ( ) , psbt. txid ( ) ) ;
915
929
wlt_1. debug_logs ( contract_id, & iface_type_name, AllocationFilter :: WalletAll ) ;
916
930
931
+ // no problem: since the force-close tx will be updated to mined soon
932
+ wlt_1. sync_and_update_witnesses ( Some ( pre_funding_height) ) ;
933
+
917
934
println ! ( "\n 7. broadcast old PSBT" ) ;
918
935
let tx = wlt_1. sign_finalize_extract ( & mut old_psbt) ;
919
936
wlt_1. broadcast_tx ( & tx) ;
0 commit comments