Correct p2sh field of decodescript RPC result.
The p2sh field in the result should be the encoded address which includes the network (human-readable address) instead of just the raw hash.
This commit is contained in:
parent
92eee5cb96
commit
8a73f9b245
1 changed files with 10 additions and 1 deletions
11
rpcserver.go
11
rpcserver.go
|
@ -741,13 +741,22 @@ func handleDecodeScript(s *rpcServer, cmd btcjson.Cmd) (interface{}, error) {
|
|||
}
|
||||
}
|
||||
|
||||
// Convert the script itself to a pay-to-script-hash address.
|
||||
p2sh, err := btcutil.NewAddressScriptHash(script, net)
|
||||
if err != nil {
|
||||
return nil, btcjson.Error{
|
||||
Code: btcjson.ErrInternal.Code,
|
||||
Message: err.Error(),
|
||||
}
|
||||
}
|
||||
|
||||
// Generate and return the reply.
|
||||
reply := btcjson.DecodeScriptResult{
|
||||
Asm: disbuf,
|
||||
ReqSigs: reqSigs,
|
||||
Type: scriptType.String(),
|
||||
Addresses: addresses,
|
||||
P2sh: hex.EncodeToString(btcutil.Hash160(script)),
|
||||
P2sh: p2sh.EncodeAddress(),
|
||||
}
|
||||
return reply, nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue