rpc: return bse64 bytes from getblock
, getblockheader
, getrawtx
Close #1522
This commit is contained in:
parent
bdd073aad7
commit
6bb81d9b51
4 changed files with 22 additions and 33 deletions
|
@ -2,6 +2,7 @@ package server
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
@ -873,7 +874,7 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) []
|
|||
require.NoErrorf(t, err, "could not parse response: %s", result)
|
||||
txBin, err := testserdes.EncodeBinary(tx)
|
||||
require.NoError(t, err)
|
||||
expected := hex.EncodeToString(txBin)
|
||||
expected := base64.StdEncoding.EncodeToString(txBin)
|
||||
assert.Equal(t, expected, res)
|
||||
})
|
||||
|
||||
|
@ -888,7 +889,7 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) []
|
|||
require.NoErrorf(t, err, "could not parse response: %s", result)
|
||||
txBin, err := testserdes.EncodeBinary(tx)
|
||||
require.NoError(t, err)
|
||||
expected := hex.EncodeToString(txBin)
|
||||
expected := base64.StdEncoding.EncodeToString(txBin)
|
||||
assert.Equal(t, expected, res)
|
||||
})
|
||||
|
||||
|
@ -924,7 +925,7 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) []
|
|||
w := io.NewBufBinWriter()
|
||||
hdr.EncodeBinary(w.BinWriter)
|
||||
require.NoError(t, w.Err)
|
||||
encoded := hex.EncodeToString(w.Bytes())
|
||||
encoded := base64.StdEncoding.EncodeToString(w.Bytes())
|
||||
|
||||
t.Run("missing", func(t *testing.T) {
|
||||
runCase(t, fmt.Sprintf(rpc, `["`+testHeaderHash+`"]`), &encoded, new(string))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue