mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-03-30 15:08:28 +00:00
added uncompressed trust anchor pub key processing (#396)
* added uncompressed trust anchor pub key processing * added a nother waiting block to pass CI test cases - these are a bit slower Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
parent
af1483a8ec
commit
ccf491d658
@ -289,6 +289,8 @@ func (s *SelectionE2ETestSuite) TestTokenRedeemClaim() {
|
||||
s.Require().NoError(err)
|
||||
|
||||
s.Require().NoError(s.network.WaitForNextBlock())
|
||||
s.Require().NoError(s.network.WaitForNextBlock()) // added another waiting block to pass CI test cases (they are a bit slower)
|
||||
|
||||
_, err = clitestutil.GetRawLogFromTxOut(val, out)
|
||||
s.Require().ErrorContains(err, "failed to execute message; message index: 0: expected: plmnt19cl05ztgt8ey6v86hjjjn3thfmpu6q2xtveehc; got: plmnt1kp93kns6hs2066d8qw0uz84fw3vlthewt2ck6p: invalid claim address")
|
||||
|
||||
|
@ -35,6 +35,12 @@ func validatePublicKey(pubkey string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// uncompressed key
|
||||
if len(pubkeyBytes) == 64 {
|
||||
return true
|
||||
}
|
||||
|
||||
// compressed key
|
||||
// Check if byte slice has correct length
|
||||
if len(pubkeyBytes) != 33 {
|
||||
return false
|
||||
|
@ -71,6 +71,18 @@ func TestMsgServerRegisterTrustAnchor(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestMsgServerRegisterTrustAnchorUncompressedKey(t *testing.T) {
|
||||
t.Parallel()
|
||||
pk := "6003d0ab9af4ec112629195a7266a244aecf1ac7691da0084be3e7ceea2ee71571b0963fffd9c80a640317509a681ac66c2ed70ecc9f317a0d2b1a9bff94ff74"
|
||||
ta := moduleobject.TrustAnchor(pk)
|
||||
msg := types.NewMsgRegisterTrustAnchor(pk, &ta)
|
||||
msgServer, ctx := setupMsgServer(t)
|
||||
res, err := msgServer.RegisterTrustAnchor(ctx, msg)
|
||||
if assert.NoError(t, err) {
|
||||
assert.Equal(t, &types.MsgRegisterTrustAnchorResponse{}, res)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMsgServerRegisterTrustAnchorTwice(t *testing.T) {
|
||||
t.Parallel()
|
||||
_, pk := sample.KeyPair()
|
||||
|
Loading…
x
Reference in New Issue
Block a user