input: add anchor witness type

This commit is contained in:
Joost Jager 2020-03-10 13:23:17 +01:00
parent dd77d9263e
commit c376cdb733
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7
6 changed files with 155 additions and 67 deletions

View File

@ -1,8 +1,12 @@
package input
import (
"math/big"
"github.com/btcsuite/btcd/blockchain"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/wire"
"github.com/lightningnetwork/lnd/keychain"
)
const (
@ -406,6 +410,47 @@ const (
OfferedHtlcPenaltyWitnessSize = 1 + 1 + 73 + 1 + 33 + 1 + OfferedHtlcScriptSize
)
// dummySigner is a fake signer used for size (upper bound) calculations.
type dummySigner struct {
Signer
}
// SignOutputRaw generates a signature for the passed transaction according to
// the data within the passed SignDescriptor.
func (s *dummySigner) SignOutputRaw(tx *wire.MsgTx, signDesc *SignDescriptor) (
[]byte, error) {
// Always return worst-case signature length, excluding the one byte
// sighash flag.
return make([]byte, 73-1), nil
}
var (
// dummyPubKey is a pubkey used in script size calculation.
dummyPubKey = btcec.PublicKey{
X: &big.Int{},
Y: &big.Int{},
}
// dummyAnchorScript is a script used for size calculation.
dummyAnchorScript, _ = CommitScriptAnchor(&dummyPubKey)
// dummyAnchorWitness is a witness used for size calculation.
dummyAnchorWitness, _ = CommitSpendAnchor(
&dummySigner{},
&SignDescriptor{
KeyDesc: keychain.KeyDescriptor{
PubKey: &dummyPubKey,
},
WitnessScript: dummyAnchorScript,
},
nil,
)
// AnchorWitnessSize 116 bytes
AnchorWitnessSize = dummyAnchorWitness.SerializeSize()
)
// EstimateCommitTxWeight estimate commitment transaction weight depending on
// the precalculated weight of base transaction, witness data, which is needed
// for paying for funding tx, and htlc weight multiplied by their count.

View File

@ -280,3 +280,11 @@ func TestTxWeightEstimator(t *testing.T) {
}
}
}
// TestSizes guards calculated constants to make sure their values remain
// unchanged.
func TestSizes(t *testing.T) {
if input.AnchorWitnessSize != 116 {
t.Fatal("unexpected anchor witness size")
}
}

View File

@ -125,6 +125,10 @@ const (
// output on the counterparty's commitment transaction after a
// confirmation.
CommitmentToRemoteConfirmed StandardWitnessType = 13
// CommitmentAnchor is a witness that allows us to spend our anchor on
// the commitment transaction.
CommitmentAnchor StandardWitnessType = 14
)
// String returns a human readable version of the target WitnessType.
@ -138,6 +142,9 @@ func (wt StandardWitnessType) String() string {
case CommitmentToRemoteConfirmed:
return "CommitmentToRemoteConfirmed"
case CommitmentAnchor:
return "CommitmentAnchor"
case CommitmentNoDelay:
return "CommitmentNoDelay"
@ -218,6 +225,16 @@ func (wt StandardWitnessType) WitnessGenerator(signer Signer,
Witness: witness,
}, nil
case CommitmentAnchor:
witness, err := CommitSpendAnchor(signer, desc, tx)
if err != nil {
return nil, err
}
return &Script{
Witness: witness,
}, nil
case CommitmentNoDelay:
witness, err := CommitSpendNoDelay(signer, desc, tx, false)
if err != nil {
@ -348,6 +365,10 @@ func (wt StandardWitnessType) SizeUpperBound() (int, bool, error) {
case CommitmentToRemoteConfirmed:
return ToRemoteConfirmedWitnessSize, false, nil
// Anchor output on the commitment transaction.
case CommitmentAnchor:
return AnchorWitnessSize, false, nil
// Outgoing second layer HTLC's that have confirmed within the
// chain, and the output they produced is now mature enough to
// sweep.

View File

@ -84,6 +84,10 @@ const (
//A witness type that allows us to sweep an output that sends to a nested P2SH
//script that pays to a key solely under our control.
WitnessType_NESTED_WITNESS_KEY_HASH WitnessType = 12
//
//A witness type that allows us to spend our anchor on the commitment
//transaction.
WitnessType_COMMITMENT_ANCHOR WitnessType = 13
)
var WitnessType_name = map[int32]string{
@ -100,6 +104,7 @@ var WitnessType_name = map[int32]string{
10: "HTLC_SECOND_LEVEL_REVOKE",
11: "WITNESS_KEY_HASH",
12: "NESTED_WITNESS_KEY_HASH",
13: "COMMITMENT_ANCHOR",
}
var WitnessType_value = map[string]int32{
@ -116,6 +121,7 @@ var WitnessType_value = map[string]int32{
"HTLC_SECOND_LEVEL_REVOKE": 10,
"WITNESS_KEY_HASH": 11,
"NESTED_WITNESS_KEY_HASH": 12,
"COMMITMENT_ANCHOR": 13,
}
func (x WitnessType) String() string {
@ -828,73 +834,73 @@ func init() {
func init() { proto.RegisterFile("walletrpc/walletkit.proto", fileDescriptor_6cc6942ac78249e5) }
var fileDescriptor_6cc6942ac78249e5 = []byte{
// 1047 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0x6b, 0x6f, 0xea, 0x46,
0x10, 0x2d, 0x21, 0x21, 0x30, 0x40, 0x42, 0x96, 0x3c, 0x7c, 0xb9, 0xb9, 0x0d, 0x75, 0x1f, 0x42,
0x7d, 0x80, 0x9a, 0xa8, 0x55, 0x1f, 0x52, 0xd5, 0x84, 0x38, 0x22, 0x82, 0x60, 0x6a, 0x3b, 0x37,
0xba, 0x55, 0xa5, 0x95, 0x03, 0x1b, 0x62, 0x01, 0xb6, 0xef, 0x7a, 0x29, 0xf8, 0x6b, 0x7f, 0x44,
0xa5, 0xfe, 0x95, 0xfe, 0xba, 0xca, 0xeb, 0x07, 0x6b, 0x68, 0x2a, 0xf5, 0x53, 0xf0, 0x39, 0x67,
0x8e, 0x67, 0x67, 0xc7, 0x33, 0x81, 0x57, 0x0b, 0x73, 0x3a, 0x25, 0x8c, 0xba, 0xc3, 0x56, 0xf8,
0x6b, 0x62, 0xb1, 0xa6, 0x4b, 0x1d, 0xe6, 0xa0, 0x42, 0x42, 0xd5, 0x0a, 0xd4, 0x1d, 0x86, 0x68,
0xed, 0xd0, 0xb3, 0xc6, 0x76, 0x20, 0x0f, 0xfe, 0x12, 0x1a, 0xa2, 0xf2, 0x2f, 0x90, 0xeb, 0x12,
0x5f, 0x23, 0xef, 0x51, 0x03, 0x2a, 0x13, 0xe2, 0xe3, 0x27, 0xcb, 0x1e, 0x13, 0x8a, 0x5d, 0x6a,
0xd9, 0x4c, 0xca, 0xd4, 0x33, 0x8d, 0x1d, 0x6d, 0x6f, 0x42, 0xfc, 0x1b, 0x0e,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0x17,
0x23, 0x7f, 0x84, 0x7c, 0xf0, 0xbe, 0x60, 0x7f, 0x20, 0x71, 0xf2, 0x08, 0xfb, 0xa5, 0x76, 0xb2,
0x81, 0x47, 0x5f, 0x4c, 0x07, 0x50, 0xb4, 0x2e, 0xc4, 0xdd, 0x22, 0xda, 0x08, 0x78, 0xad, 0x26,
0x7e, 0x47, 0x6b, 0x5b, 0xa6, 0x07, 0x45, 0x61, 0xc4, 0xa3, 0x37, 0x82, 0x74, 0x73, 0xb1, 0xd4,
0x3e, 0x7c, 0x89, 0x5e, 0xb9, 0x09, 0xb3, 0x3c, 0xe5, 0xb6, 0xb9, 0x1a, 0x52, 0x6e, 0xff, 0xb6,
0x02, 0x34, 0x28, 0xa7, 0x06, 0x06, 0x3a, 0x7b, 0x61, 0x20, 0x24, 0xf9, 0xd5, 0x5f, 0x16, 0x44,
0x9e, 0x3f, 0xc3, 0x6e, 0xf4, 0x49, 0xa2, 0x57, 0x82, 0x38, 0x3d, 0x3e, 0x52, 0x15, 0x5b, 0xfb,
0x82, 0xaf, 0xbe, 0xfe, 0xb5, 0x35, 0xb6, 0xd8, 0xf3, 0xfc, 0xb1, 0x39, 0x74, 0x66, 0xad, 0x69,
0x30, 0x71, 0x6d, 0xcb, 0x1e, 0xdb, 0x84, 0x2d, 0x1c, 0x3a, 0x69, 0x4d, 0xed, 0x51, 0x8b, 0x4f,
0x9a, 0x56, 0x62, 0xf1, 0x98, 0xe3, 0xff, 0x90, 0x5c, 0xfc, 0x13, 0x00, 0x00, 0xff, 0xff, 0x3b,
0x08, 0xac, 0xe2, 0xd9, 0x08, 0x00, 0x00,
// 1055 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0x6b, 0x6f, 0xe2, 0x46,
0x14, 0x2d, 0x21, 0x21, 0x70, 0x81, 0xc4, 0x19, 0xf2, 0xf0, 0xb2, 0xd9, 0x86, 0xba, 0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1, 0x4b, 0xf4, 0xca, 0x4d, 0x18, 0xf1, 0x29,
0xb7, 0xcd, 0x8d, 0x91, 0x72, 0xfb, 0xb7, 0xcd, 0xa0, 0x43, 0x39, 0x35, 0x47, 0xd0, 0xd9, 0x0b,
0x73, 0x22, 0xc9, 0xaf, 0xf6, 0xb2, 0x20, 0xf2, 0xfc, 0x15, 0x76, 0xa3, 0x2f, 0x15, 0xbd, 0x12,
0xc4, 0xe9, 0xa9, 0x92, 0xaa, 0xd8, 0xda, 0x87, 0x7d, 0xf9, 0xed, 0xef, 0xcd, 0xb1, 0xcd, 0x9e,
0x66, 0x0f, 0x8d, 0xa1, 0x3b, 0x6d, 0x4e, 0x82, 0x41, 0xec, 0xd8, 0xce, 0xd8, 0x21, 0x6c, 0xee,
0xd2, 0xe7, 0xe6, 0xc4, 0x19, 0x35, 0xf9, 0x00, 0x6a, 0x26, 0x16, 0x0f, 0x39, 0xfe, 0x7f, 0xca,
0xc5, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf1, 0x3f, 0xcd, 0xa5, 0xf0, 0x08, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.

View File

@ -164,6 +164,12 @@ enum WitnessType {
script that pays to a key solely under our control.
*/
NESTED_WITNESS_KEY_HASH = 12;
/*
A witness type that allows us to spend our anchor on the commitment
transaction.
*/
COMMITMENT_ANCHOR = 13;
}
message PendingSweep {

View File

@ -390,6 +390,8 @@ func (w *WalletKit) PendingSweeps(ctx context.Context,
witnessType = WitnessType_WITNESS_KEY_HASH
case input.NestedWitnessKeyHash:
witnessType = WitnessType_NESTED_WITNESS_KEY_HASH
case input.CommitmentAnchor:
witnessType = WitnessType_COMMITMENT_ANCHOR
default:
log.Warnf("Unhandled witness type %v for input %v",
pendingInput.WitnessType, pendingInput.OutPoint)