rpc: validate closing channel address in open channel requests

Our OpenChannelRPC was accepting invalid values for the closing address
field. If we were able to decode the address we would use it in the
script even if the address is for another bitcoin net.
This commit is contained in:
positiveblue
2022-12-23 03:26:55 -08:00
parent c03de26dcc
commit 2204cbfd30
4 changed files with 64 additions and 4 deletions

View File

@@ -55,7 +55,7 @@ func newChanAcceptorCtx(t *testing.T, acceptCallCount int,
testCtx.acceptor = NewRPCAcceptor(
testCtx.receiveResponse, testCtx.sendRequest, testTimeout*5,
&chaincfg.TestNet3Params, testCtx.quit,
&chaincfg.RegressionNetParams, testCtx.quit,
)
return testCtx
@@ -162,7 +162,7 @@ func (c *channelAcceptorCtx) queryAndAssert(queries map[*lnwire.OpenChannel]*Cha
func TestMultipleAcceptClients(t *testing.T) {
testAddr := "bcrt1qwrmq9uca0t3dy9t9wtuq5tm4405r7tfzyqn9pp"
testUpfront, err := chancloser.ParseUpfrontShutdownAddress(
testAddr, &chaincfg.TestNet3Params,
testAddr, &chaincfg.RegressionNetParams,
)
require.NoError(t, err)