channeldb: don't store commit sig separately, expected to be within the txin of the commit tx
This commit is contained in:
parent
1fd1d87e34
commit
1b9d34f614
@ -61,12 +61,11 @@ type OpenChannel struct {
|
|||||||
OurBalance btcutil.Amount
|
OurBalance btcutil.Amount
|
||||||
TheirBalance btcutil.Amount
|
TheirBalance btcutil.Amount
|
||||||
|
|
||||||
// Commitment transactions for both sides (they're asymmetric). Also
|
// Commitment transactions for both sides (they're asymmetric). Our
|
||||||
// their signature which lets us spend our version of the commitment
|
// commitment transaction includes a valid sigScript, and is ready for
|
||||||
// transaction.
|
// broadcast.
|
||||||
TheirCommitTx *wire.MsgTx
|
TheirCommitTx *wire.MsgTx
|
||||||
OurCommitTx *wire.MsgTx // TODO(roasbeef): store hash instead?
|
OurCommitTx *wire.MsgTx // TODO(roasbeef): store hash instead?
|
||||||
TheirCommitSig []byte // TODO(roasbeef): fixed length?, same w/ redeem
|
|
||||||
|
|
||||||
// The final funding transaction. Kept wallet-related records.
|
// The final funding transaction. Kept wallet-related records.
|
||||||
FundingTx *wire.MsgTx
|
FundingTx *wire.MsgTx
|
||||||
@ -82,6 +81,7 @@ type OpenChannel struct {
|
|||||||
OurShaChain *shachain.HyperShaChain
|
OurShaChain *shachain.HyperShaChain
|
||||||
|
|
||||||
// Final delivery address
|
// Final delivery address
|
||||||
|
// TODO(roasbeef): should just be output scripts
|
||||||
OurDeliveryAddress btcutil.Address
|
OurDeliveryAddress btcutil.Address
|
||||||
TheirDeliveryAddress btcutil.Address
|
TheirDeliveryAddress btcutil.Address
|
||||||
|
|
||||||
@ -227,9 +227,6 @@ func (o *OpenChannel) Encode(b io.Writer, addrManager *waddrmgr.Manager) error {
|
|||||||
if err := o.OurCommitTx.Serialize(b); err != nil {
|
if err := o.OurCommitTx.Serialize(b); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := b.Write(o.TheirCommitSig[:]); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := o.FundingTx.Serialize(b); err != nil {
|
if err := o.FundingTx.Serialize(b); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -337,15 +334,6 @@ func (o *OpenChannel) Decode(b io.Reader, addrManager *waddrmgr.Manager) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var sig [64]byte
|
|
||||||
if _, err := b.Read(sig[:]); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
o.TheirCommitSig = sig[:]
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
o.FundingTx = wire.NewMsgTx()
|
o.FundingTx = wire.NewMsgTx()
|
||||||
if err := o.FundingTx.Deserialize(b); err != nil {
|
if err := o.FundingTx.Deserialize(b); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -19,7 +19,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
sig = bytes.Repeat([]byte{1}, 64)
|
|
||||||
key = [wire.HashSize]byte{
|
key = [wire.HashSize]byte{
|
||||||
0x81, 0xb6, 0x37, 0xd8, 0xfc, 0xd2, 0xc6, 0xda,
|
0x81, 0xb6, 0x37, 0xd8, 0xfc, 0xd2, 0xc6, 0xda,
|
||||||
0x68, 0x59, 0xe6, 0x96, 0x31, 0x13, 0xa1, 0x17,
|
0x68, 0x59, 0xe6, 0x96, 0x31, 0x13, 0xa1, 0x17,
|
||||||
@ -144,7 +143,6 @@ func TestOpenChannelEncodeDecode(t *testing.T) {
|
|||||||
TheirBalance: btcutil.Amount(7000),
|
TheirBalance: btcutil.Amount(7000),
|
||||||
TheirCommitTx: testTx,
|
TheirCommitTx: testTx,
|
||||||
OurCommitTx: testTx,
|
OurCommitTx: testTx,
|
||||||
TheirCommitSig: sig,
|
|
||||||
FundingTx: testTx,
|
FundingTx: testTx,
|
||||||
MultiSigKey: privKey,
|
MultiSigKey: privKey,
|
||||||
FundingRedeemScript: script,
|
FundingRedeemScript: script,
|
||||||
@ -224,10 +222,6 @@ func TestOpenChannelEncodeDecode(t *testing.T) {
|
|||||||
t.Fatalf("ourCommitTx doesn't match")
|
t.Fatalf("ourCommitTx doesn't match")
|
||||||
}
|
}
|
||||||
|
|
||||||
if !bytes.Equal(state.TheirCommitSig, newState.TheirCommitSig) {
|
|
||||||
t.Fatalf("theirCommitSig doesn't match")
|
|
||||||
}
|
|
||||||
|
|
||||||
b1.Reset()
|
b1.Reset()
|
||||||
b2.Reset()
|
b2.Reset()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user