mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-30 16:10:01 +01:00
routing: add new error for failed funding tx validation
In this commit we add a new error for when we fail to validate the funding transaction (invalid script, etc) and mark it as a zombie like the other failed validation cases.
This commit is contained in:
@@ -3149,6 +3149,10 @@ const (
|
||||
// edgeCreationNoUTXO is used to skip adding the UTXO of a channel to
|
||||
// the UTXO set.
|
||||
edgeCreationNoUTXO
|
||||
|
||||
// edgeCreationBadScript is used to create the edge, but use the wrong
|
||||
// scrip which should cause it to fail output validation.
|
||||
edgeCreationBadScript
|
||||
)
|
||||
|
||||
// newChannelEdgeInfo is a helper function used to create a new channel edge,
|
||||
@@ -3196,6 +3200,10 @@ func newChannelEdgeInfo(ctx *testCtx, fundingHeight uint32,
|
||||
})
|
||||
}
|
||||
|
||||
if ecm == edgeCreationBadScript {
|
||||
fundingTx.TxOut[0].PkScript[0] ^= 1
|
||||
}
|
||||
|
||||
return edge, nil
|
||||
}
|
||||
|
||||
@@ -3247,4 +3255,10 @@ func TestChannelOnChainRejectionZombie(t *testing.T) {
|
||||
// Instead now, we'll remove it from the set of UTXOs which should
|
||||
// cause the spentness validation to fail.
|
||||
assertChanChainRejection(t, ctx, edge, ErrChannelSpent)
|
||||
|
||||
// If we cause the funding transaction the chain to fail validation, we
|
||||
// should see similar behavior.
|
||||
edge, err = newChannelEdgeInfo(ctx, 3, edgeCreationBadScript)
|
||||
require.Nil(t, err)
|
||||
assertChanChainRejection(t, ctx, edge, ErrInvalidFundingOutput)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user