Merge pull request #1543 from cfromknecht/wtblob

[watchtower/blob]: Blob of Justice encryption/decryption and v0 plaintext encoding
This commit is contained in:
Olaoluwa Osuntokun authored and GitHub committed 2018-07-31 20:55:29 -07:00
commit a5174a2228
5 files changed
+619 -7

No files matched your search

+3 -3
View File
@@ -1973,7 +1973,7 @@ func NewBreachRetribution(chanState *channeldb.OpenChannel, stateNum uint64,
if err != nil {
return nil, err
}
localPkScript, err := commitScriptUnencumbered(keyRing.NoDelayKey)
localPkScript, err := CommitScriptUnencumbered(keyRing.NoDelayKey)
if err != nil {
return nil, err
}
@@ -5044,7 +5044,7 @@ func NewUnilateralCloseSummary(chanState *channeldb.OpenChannel, signer Signer,
// Before we can generate the proper sign descriptor, we'll need to
// locate the output index of our non-delayed output on the commitment
// transaction.
selfP2WKH, err := commitScriptUnencumbered(keyRing.NoDelayKey)
selfP2WKH, err := CommitScriptUnencumbered(keyRing.NoDelayKey)
if err != nil {
return nil, fmt.Errorf("unable to create self commit script: %v", err)
}
@@ -6065,7 +6065,7 @@ func CreateCommitTx(fundingOutput wire.TxIn,
// Next, we create the script paying to them. This is just a regular
// P2WPKH output, without any added CSV delay.
theirWitnessKeyHash, err := commitScriptUnencumbered(keyRing.NoDelayKey)
theirWitnessKeyHash, err := CommitScriptUnencumbered(keyRing.NoDelayKey)
if err != nil {
return nil, err
}
+2 -2
View File
@@ -953,10 +953,10 @@ func CommitScriptToSelf(csvTimeout uint32, selfKey, revokeKey *btcec.PublicKey)
return builder.Script()
}
// commitScriptUnencumbered constructs the public key script on the commitment
// CommitScriptUnencumbered constructs the public key script on the commitment
// transaction paying to the "other" party. The constructed output is a normal
// p2wkh output spendable immediately, requiring no contestation period.
func commitScriptUnencumbered(key *btcec.PublicKey) ([]byte, error) {
func CommitScriptUnencumbered(key *btcec.PublicKey) ([]byte, error) {
// This script goes to the "other" party, and it spendable immediately.
builder := txscript.NewScriptBuilder()
builder.AddOp(txscript.OP_0)
+2 -2
View File
@@ -90,7 +90,7 @@ func TestCommitmentSpendValidation(t *testing.T) {
// We're testing an uncooperative close, output sweep, so construct a
// transaction which sweeps the funds to a random address.
targetOutput, err := commitScriptUnencumbered(aliceKeyPub)
targetOutput, err := CommitScriptUnencumbered(aliceKeyPub)
if err != nil {
t.Fatalf("unable to create target output: %v", err)
}
@@ -186,7 +186,7 @@ func TestCommitmentSpendValidation(t *testing.T) {
// Finally, we test bob sweeping his output as normal in the case that
// Alice broadcasts this commitment transaction.
bobScriptP2WKH, err := commitScriptUnencumbered(bobPayKey)
bobScriptP2WKH, err := CommitScriptUnencumbered(bobPayKey)
if err != nil {
t.Fatalf("unable to create bob p2wkh script: %v", err)
}