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