Beispiel #1
0
func (m *TMHello) Extend() (ExtendedMessage, error) {
	key, err := crypto.ParsePublicKeyFromHash(m.NodePublic)
	if err != nil {
		return nil, err
	}
	sig, err := crypto.ParseSignature(m.NodeProof)
	if err != nil {
		return nil, err
	}
	return &Hello{
		TMHello:    m,
		Version:    fmt.Sprintf("%d.%d", m.GetProtoVersion()>>16, m.GetProtoVersion()&0xFFFF),
		MinVersion: fmt.Sprintf("%d.%d", m.GetProtoVersionMin()>>16, m.GetProtoVersionMin()&0xFFFF),
		PublicKey:  key,
		Signature:  sig,
	}, nil
}
Beispiel #2
0
func (m *TMProposeSet) Extend() (ExtendedMessage, error) {
	key, err := crypto.ParsePublicKey(m.NodePubKey)
	if err != nil {
		return nil, err
	}
	public, err := crypto.NewRipplePublicNode(key.SerializeCompressed())
	if err != nil {
		return nil, err
	}
	sig, err := crypto.ParseSignature(m.Signature)
	if err != nil {
		return nil, err
	}
	return &ProposeSet{
		TMProposeSet: m,
		PublicKey:    key,
		Signature:    sig,
		NodePublic:   public,
	}, nil
}