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 committed 2023-01-04 04:42:39 -08:00
1 parent c03de26dcc
commit 2204cbfd30
4 files changed
+64 -4

No files matched your search

+2 -2
View File
@@ -20,7 +20,7 @@ func TestValidateAcceptorResponse(t *testing.T) {
customError = errors.New("custom error")
validAddr = "bcrt1qwrmq9uca0t3dy9t9wtuq5tm4405r7tfzyqn9pp"
addr, _ = chancloser.ParseUpfrontShutdownAddress(
validAddr, &chaincfg.TestNet3Params,
validAddr, &chaincfg.RegressionNetParams,
)
)
@@ -124,7 +124,7 @@ func TestValidateAcceptorResponse(t *testing.T) {
// Create an acceptor, everything can be nil because
// we just need the params.
acceptor := NewRPCAcceptor(
nil, nil, 0, &chaincfg.TestNet3Params, nil,
nil, nil, 0, &chaincfg.RegressionNetParams, nil,
)
accept, acceptErr, shutdown, err := acceptor.validateAcceptorResponse(