mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 01:36:24 +01:00
lnwallet/test: move test htlcs out of function
This commit is contained in:
parent
98ec8bf502
commit
c27406b579
1 changed files with 40 additions and 40 deletions
|
@ -222,46 +222,8 @@ func newTestContext() (tc *testContext, err error) {
|
|||
TxPosition: 0,
|
||||
}
|
||||
|
||||
htlcData := []struct {
|
||||
incoming bool
|
||||
amount lnwire.MilliSatoshi
|
||||
expiry uint32
|
||||
preimage string
|
||||
}{
|
||||
{
|
||||
incoming: true,
|
||||
amount: 1000000,
|
||||
expiry: 500,
|
||||
preimage: "0000000000000000000000000000000000000000000000000000000000000000",
|
||||
},
|
||||
{
|
||||
incoming: true,
|
||||
amount: 2000000,
|
||||
expiry: 501,
|
||||
preimage: "0101010101010101010101010101010101010101010101010101010101010101",
|
||||
},
|
||||
{
|
||||
incoming: false,
|
||||
amount: 2000000,
|
||||
expiry: 502,
|
||||
preimage: "0202020202020202020202020202020202020202020202020202020202020202",
|
||||
},
|
||||
{
|
||||
incoming: false,
|
||||
amount: 3000000,
|
||||
expiry: 503,
|
||||
preimage: "0303030303030303030303030303030303030303030303030303030303030303",
|
||||
},
|
||||
{
|
||||
incoming: true,
|
||||
amount: 4000000,
|
||||
expiry: 504,
|
||||
preimage: "0404040404040404040404040404040404040404040404040404040404040404",
|
||||
},
|
||||
}
|
||||
|
||||
tc.htlcs = make([]channeldb.HTLC, len(htlcData))
|
||||
for i, htlc := range htlcData {
|
||||
tc.htlcs = make([]channeldb.HTLC, len(testHtlcs))
|
||||
for i, htlc := range testHtlcs {
|
||||
preimage, decodeErr := hex.DecodeString(htlc.preimage)
|
||||
if decodeErr != nil {
|
||||
err = fmt.Errorf("Failed to decode HTLC preimage: %v", decodeErr)
|
||||
|
@ -341,6 +303,44 @@ func (tc *testContext) extractFundingInput() (*Utxo, *wire.TxOut, error) {
|
|||
return &block1Utxo, txout, nil
|
||||
}
|
||||
|
||||
var testHtlcs = []struct {
|
||||
incoming bool
|
||||
amount lnwire.MilliSatoshi
|
||||
expiry uint32
|
||||
preimage string
|
||||
}{
|
||||
{
|
||||
incoming: true,
|
||||
amount: 1000000,
|
||||
expiry: 500,
|
||||
preimage: "0000000000000000000000000000000000000000000000000000000000000000",
|
||||
},
|
||||
{
|
||||
incoming: true,
|
||||
amount: 2000000,
|
||||
expiry: 501,
|
||||
preimage: "0101010101010101010101010101010101010101010101010101010101010101",
|
||||
},
|
||||
{
|
||||
incoming: false,
|
||||
amount: 2000000,
|
||||
expiry: 502,
|
||||
preimage: "0202020202020202020202020202020202020202020202020202020202020202",
|
||||
},
|
||||
{
|
||||
incoming: false,
|
||||
amount: 3000000,
|
||||
expiry: 503,
|
||||
preimage: "0303030303030303030303030303030303030303030303030303030303030303",
|
||||
},
|
||||
{
|
||||
incoming: true,
|
||||
amount: 4000000,
|
||||
expiry: 504,
|
||||
preimage: "0404040404040404040404040404040404040404040404040404040404040404",
|
||||
},
|
||||
}
|
||||
|
||||
// testCases encode the raw test vectors specified in Appendix C of BOLT 03.
|
||||
var testCases = []struct {
|
||||
commitment channeldb.ChannelCommitment
|
||||
|
|
Loading…
Add table
Reference in a new issue