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:
Olaoluwa Osuntokun committed 2019-01-09 15:55:22 -08:00
1 parent 40f0dbb5e6
commit 4ad175c16d
2 files changed
+42 -17

No files matched your search

+3 -1
View File
@@ -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()