@@ -13,6 +13,8 @@ import (
1313
1414var  sweepTimeLockManualCases  =  []struct  {
1515	baseKey          string 
16+ 	rootKey          string 
17+ 	basePath         []uint32 
1618	keyIndex         uint32 
1719	timeLockAddr     string 
1820	remoteRevPubKey  string 
@@ -58,7 +60,7 @@ var sweepTimeLockManualCases = []struct {
5860	// when already the old format was present, this leads to the situation 
5961	// where the idx for the shachain root (revocation root) is equal to 
6062	// the delay basepoint index. Normally when starting a node after 
61- 	// lnd with the version v0.13.0-beta onwords , the index is always 
63+ 	// lnd with the version v0.13.0-beta onwards , the index is always 
6264	// +1 compared to the delay basepoint index. 
6365	baseKey : "tprv8e3Mee42NcUd2MbwxBCJyEEhvKa8KqjiDR76M7ym4DJSfZ"  + 
6466		"kfDyA46XZeA4kTj8YKktWrjGBDThxxcL4HBF89jDKseu24XtugVMNsm3GhHwK" ,
@@ -67,6 +69,16 @@ var sweepTimeLockManualCases = []struct {
6769		"rhetju2srseqrh" ,
6870	remoteRevPubKey : "0341692a025ad552c62689a630ff24d9439e3752d8e0ac5cb4"  + 
6971		"1b5e71ab2bd46d0f" ,
72+ }, {
73+ 	// Anchor channel with lnd 0.18.x-beta. 
74+ 	rootKey : "tprv8ZgxMBicQKsPdRiEUwMA71fkU9XoiPakhuSAEGCfcpgZxraB"  + 
75+ 		"eXKCfJSVo2SMAAEENrZU6x4V5gu5at6cpnasaf9oSrUh72zXaEdWDgSFVEf" ,
76+ 	basePath : []uint32 {lnd .HardenedKey (1017 ), lnd .HardenedKey (1 )},
77+ 	keyIndex : 3 ,
78+ 	timeLockAddr : "bcrt1qqm2u8pyqjc8akatdyap5qsjh7z4fuytwaehsjndt93e50l0"  + 
79+ 		"sup4qa2384v" ,
80+ 	remoteRevPubKey : "028a2199d9c64f21b59c01a5d5429fbe78b8709f0270deaf91"  + 
81+ 		"578f682b87a12796" ,
7082}}
7183
7284func  TestSweepTimeLockManual (t  * testing.T ) {
@@ -79,8 +91,17 @@ func TestSweepTimeLockManual(t *testing.T) {
7991		)
8092		require .NoError (t , err )
8193
82- 		baseKey , err  :=  hdkeychain .NewKeyFromString (tc .baseKey )
83- 		require .NoError (t , err )
94+ 		var  baseKey  * hdkeychain.ExtendedKey 
95+ 		if  tc .baseKey  !=  ""  {
96+ 			baseKey , err  =  hdkeychain .NewKeyFromString (tc .baseKey )
97+ 			require .NoError (t , err )
98+ 		} else  {
99+ 			rootKey , err  :=  hdkeychain .NewKeyFromString (tc .rootKey )
100+ 			require .NoError (t , err )
101+ 
102+ 			baseKey , err  =  lnd .DeriveChildren (rootKey , tc .basePath )
103+ 			require .NoError (t , err )
104+ 		}
84105
85106		revPubKeyBytes , _  :=  hex .DecodeString (tc .remoteRevPubKey )
86107		revPubKey , _  :=  btcec .ParsePubKey (revPubKeyBytes )
0 commit comments