Skip to content

Commit

Permalink
use legacy amino
Browse files Browse the repository at this point in the history
  • Loading branch information
sahith-narahari committed Nov 12, 2020
1 parent c431f61 commit c63707e
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions server/rosetta/services/construction.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (sn SingleNetwork) ConstructionCombine(ctx context.Context, request *types.
sig := signing.SignatureV2{
PubKey: pubKey,
Data: &signing.SingleSignatureData{
SignMode: signing.SignMode_SIGN_MODE_DIRECT,
SignMode: signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON,
Signature: signature.Bytes,
},
Sequence: accountInfo.GetSequence(),
Expand Down Expand Up @@ -222,7 +222,7 @@ func (sn SingleNetwork) ConstructionPayloads(ctx context.Context, request *types
txBldr, err := tx.BuildUnsignedTx(txFactory, sendMsg)

if txFactory.SignMode() == signing.SignMode_SIGN_MODE_UNSPECIFIED {
txFactory = txFactory.WithSignMode(signing.SignMode_SIGN_MODE_DIRECT)
txFactory = txFactory.WithSignMode(signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON)
}

signerData := authsigning.SignerData{
Expand All @@ -231,19 +231,6 @@ func (sn SingleNetwork) ConstructionPayloads(ctx context.Context, request *types
Sequence: txFactory.Sequence(),
}

sigData := signing.SingleSignatureData{
SignMode: txFactory.SignMode(),
Signature: nil,
}
sig := signing.SignatureV2{
PubKey: pubKey,
Data: &sigData,
Sequence: txFactory.Sequence(),
}
if err := txBldr.SetSignatures(sig); err != nil {
return nil, rosetta.WrapError(rosetta.ErrInvalidRequest, err.Error()).RosettaError()
}

signBytes, err := TxConfig.SignModeHandler().GetSignBytes(txFactory.SignMode(), signerData, txBldr.GetTx())
if err != nil {
return nil, rosetta.ToRosettaError(err)
Expand Down

0 comments on commit c63707e

Please sign in to comment.