sweep: update getInputWitnessSizeUpperBound to be aware of nested p2sh
In this commit, we update the `getInputWitnessSizeUpperBound` and all its callers to be aware of nested p2sh witness inputs. We do so by adding another bool which is true if the output is a nested p2sh output. If so, then in order to properly estimate the total weight, the caller needs to factor in the non-witness data of the additional sigScript data push.
This commit is contained in:
2 files changed
+42
-17
No files matched your search
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/build"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
@@ -376,7 +377,8 @@ func TestNegativeInput(t *testing.T) {
|
||||
if !testTxIns(&sweepTx1, []*wire.OutPoint{
|
||||
largeInput.OutPoint(), positiveInput.OutPoint(),
|
||||
}) {
|
||||
t.Fatal("Tx does not contain expected inputs")
|
||||
t.Fatalf("Tx does not contain expected inputs: %v",
|
||||
spew.Sdump(sweepTx1))
|
||||
}
|
||||
|
||||
ctx.backend.mine()
|
||||
|
||||
Reference in new issue
Block a user