Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added bin/rosetta-cli
Binary file not shown.
11 changes: 6 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/deso-protocol/core v1.1.0
github.com/deso-protocol/go-deadlock v1.0.0
github.com/deso-protocol/go-merkle-tree v1.0.0
github.com/dgraph-io/badger/v3 v3.2103.0
github.com/dgraph-io/badger/v3 v3.2103.5
github.com/golang/glog v1.0.0
github.com/mitchellh/go-homedir v1.1.0
github.com/pkg/errors v0.9.1
Expand All @@ -34,7 +34,7 @@ require (
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/decred/dcrd/lru v1.1.1 // indirect
github.com/dgraph-io/ristretto v0.1.0 // indirect
github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/ethereum/go-ethereum v1.9.25 // indirect
github.com/fatih/color v1.13.0 // indirect
Expand All @@ -57,6 +57,7 @@ require (
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/klauspost/compress v1.12.3 // indirect
github.com/magiconair/properties v1.8.1 // indirect
github.com/mattn/go-colorable v0.1.9 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
Expand Down Expand Up @@ -87,10 +88,10 @@ require (
github.com/vmihailenco/tagparser v0.1.2 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
go.opencensus.io v0.23.0 // indirect
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20220909162455-aba9fc2a8ff2 // indirect
golang.org/x/sys v0.0.0-20221010170243-090e33056c14 // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 // indirect
golang.org/x/tools v0.1.5 // indirect
Expand Down
13 changes: 13 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,15 @@ github.com/deso-protocol/go-merkle-tree v1.0.0/go.mod h1:V/vbg/maaNv6G7zf9VVs645
github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE=
github.com/dgraph-io/badger/v3 v3.2103.0 h1:abkD2EnP3+6Tj8h5LI1y00dJ9ICKTIAzvG9WmZ8S2c4=
github.com/dgraph-io/badger/v3 v3.2103.0/go.mod h1:GHMCYxuDWyzbHkh4k3yyg4PM61tJPFfEGSMbE3Vd5QE=
github.com/dgraph-io/badger/v3 v3.2103.5 h1:ylPa6qzbjYRQMU6jokoj4wzcaweHylt//CH0AKt0akg=
github.com/dgraph-io/badger/v3 v3.2103.5/go.mod h1:4MPiseMeDQ3FNCYwRbbcBOGJLf5jsE0PPFzRiKjtcdw=
github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E=
github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E=
github.com/dgraph-io/ristretto v0.0.4-0.20210309073149-3836124cdc5a/go.mod h1:MIonLggsKgZLUSt414ExgwNtlOL5MuEoAJP514mwGe8=
github.com/dgraph-io/ristretto v0.1.0 h1:Jv3CGQHp9OjuMBSne1485aDpUkTKEcUqF+jm/LuerPI=
github.com/dgraph-io/ristretto v0.1.0/go.mod h1:fux0lOrBhrVCJd3lcTHsIJhq1T2rokOu6v9Vcb3Q9ug=
github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8=
github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y=
Expand Down Expand Up @@ -217,6 +221,7 @@ github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/flatbuffers v1.12.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
github.com/google/flatbuffers v1.12.1/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
github.com/google/flatbuffers v2.0.0+incompatible h1:dicJ2oXwypfwUGnB2/TYWYEKiuk9eYQlQO/AnOHl5mI=
github.com/google/flatbuffers v2.0.0+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
Expand Down Expand Up @@ -311,6 +316,8 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
github.com/klauspost/compress v1.12.3 h1:G5AfA94pHPysR56qqrkO2pxEexdDzrpFJ6yt/VqWxVU=
github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
Expand Down Expand Up @@ -551,6 +558,8 @@ golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -607,6 +616,8 @@ golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwY
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -661,6 +672,8 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220909162455-aba9fc2a8ff2 h1:wM1k/lXfpc5HdkJJyW9GELpd8ERGdnh8sMGL6Gzq3Ho=
golang.org/x/sys v0.0.0-20220909162455-aba9fc2a8ff2/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20221010170243-090e33056c14 h1:k5II8e6QD8mITdi+okbbmR/cIyEbeXLBhy5Ha4nevyc=
golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
1 change: 1 addition & 0 deletions scripts/testnet/hypersync_online.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
--sync-type=hypersync \
--force-checksum=false \
--network TESTNET \
# --connect-ips=test.deso.org:18000 \
)
1 change: 0 additions & 1 deletion scripts/testnet/offline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ set -v
--port 17006 \
--data-directory /tmp/rosetta-offline-00002 \
--network TESTNET \
--regtest \
)
147 changes: 31 additions & 116 deletions services/construction_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package services
import (
"context"
"encoding/hex"
"encoding/json"
"fmt"
"github.com/btcsuite/btcd/btcec"
"github.com/coinbase/rosetta-sdk-go/server"
Expand All @@ -13,7 +12,6 @@ import (
"github.com/deso-protocol/rosetta-deso/deso"
"github.com/pkg/errors"
"math/big"
"reflect"
"strconv"
)

Expand Down Expand Up @@ -59,21 +57,6 @@ func (s *ConstructionAPIService) ConstructionPreprocess(ctx context.Context, req
if op.Type == deso.InputOpType {
// Add the account identifier to our map
inputPubKeysFoundMap[op.Account.Address] = true

if request.Metadata != nil {
if useLegacyUtxos, exists := request.Metadata["legacy_utxo_selection"]; exists && useLegacyUtxos.(bool) {
txId, txnIndex, err := ParseCoinIdentifier(op.CoinChange.CoinIdentifier)
if err != nil {
return nil, wrapErr(ErrInvalidCoin, err)
}

// Include the inputs in case we use legacy utxo selection
optionsObj.DeSoInputs = append(optionsObj.DeSoInputs, &desoInput{
TxHex: hex.EncodeToString(txId.ToBytes()),
Index: txnIndex,
})
}
}
} else if op.Type == deso.OutputOpType {
// Parse the amount of this output
amount, err := strconv.ParseUint(op.Amount.Value, 10, 64)
Expand Down Expand Up @@ -164,10 +147,6 @@ func (s *ConstructionAPIService) ConstructionMetadata(ctx context.Context, reque
return nil, wrapErr(ErrUnableToParseIntermediateResult, err)
}

if options.LegacyUTXOSelection && s.node.GetBlockchain().BlockTip().Height >= s.node.Params.ForkHeights.BalanceModelBlockHeight {
return nil, ErrLegacyUtxoSelectionNotAllowed
}

// Determine the network-wide feePerKB rate
feePerKB := mempoolView.GlobalParamsEntry.MinimumNetworkFeeNanosPerKB
if feePerKB == 0 {
Expand Down Expand Up @@ -209,35 +188,9 @@ func (s *ConstructionAPIService) ConstructionMetadata(ctx context.Context, reque
}

var fee uint64

// Support legacy utxo selection
if options.LegacyUTXOSelection {
txn.TxInputs = []*lib.DeSoInput{}
for _, input := range options.DeSoInputs {
txId, err := hex.DecodeString(input.TxHex)
if err != nil {
return nil, wrapErr(ErrInvalidTransaction, err)
}

txn.TxInputs = append(txn.TxInputs, &lib.DeSoInput{
TxID: *lib.NewBlockHash(txId),
Index: input.Index,
})
}

txnBytes, err := txn.ToBytes(true)
if err != nil {
return nil, wrapErr(ErrInvalidTransaction, err)
}

// Override fee calculation
txnSize := uint64(len(txnBytes) + MaxDERSigLen + FeeByteBuffer)
fee = feePerKB * txnSize / BytesPerKb
} else {
_, _, _, fee, err = s.node.GetBlockchain().AddInputsAndChangeToTransaction(txn, feePerKB, s.node.GetMempool())
if err != nil {
return nil, wrapErr(ErrInvalidTransaction, err)
}
_, _, _, fee, err = s.node.GetBlockchain().AddInputsAndChangeToTransaction(txn, feePerKB, s.node.GetMempool())
if err != nil {
return nil, wrapErr(ErrInvalidTransaction, err)
}

// If the caller specified a partial ID, apply it to the transaction's nonce (as long as the nonce exists).
Expand Down Expand Up @@ -286,7 +239,6 @@ func (s *ConstructionAPIService) ConstructionMetadata(ctx context.Context, reque
metadata, err := types.MarshalMap(&constructionMetadata{
FeePerKB: feePerKB,
DeSoSampleTxnHex: hex.EncodeToString(desoTxnBytes),
LegacyUTXOSelection: options.LegacyUTXOSelection,
NoncePartialID: options.NoncePartialID,
NonceExpirationBlockHeight: options.NonceExpirationBlockHeight,
NonceExpirationBlockHeightOffset: options.NonceExpirationBlockHeightOffset,
Expand Down Expand Up @@ -331,26 +283,14 @@ func (s *ConstructionAPIService) ConstructionPayloads(ctx context.Context, reque
}

// We should only have one input with the balance model
// TODO: This check is disabled to support legacy utxo selection
//if len(inputAmounts) != 1 {
// return nil, wrapErr(ErrInvalidTransaction, fmt.Errorf("Txn must have exactly one input but found %v", len(inputAmounts)))
//}
if len(inputAmounts) != 1 {
return nil, wrapErr(ErrInvalidTransaction, fmt.Errorf("Txn must have exactly one input but found %v", len(inputAmounts)))
}

unsignedBytes := merkletree.Sha256DoubleHash(desoTxnBytes)

unsignedTxn, err := json.Marshal(&transactionMetadata{
Transaction: desoTxnBytes,
InputAmounts: inputAmounts,
LegacyUTXOSelection: metadata.LegacyUTXOSelection,
NoncePartialID: metadata.NoncePartialID,
NonceExpirationBlockHeight: metadata.NonceExpirationBlockHeight,
NonceExpirationBlockHeightOffset: metadata.NonceExpirationBlockHeightOffset,
TxnFeeNanos: metadata.TxnFeeNanos,
FeeRateNanosPerKB: metadata.FeeRateNanosPerKB,
})

return &types.ConstructionPayloadsResponse{
UnsignedTransaction: hex.EncodeToString(unsignedTxn),
UnsignedTransaction: hex.EncodeToString(desoTxnBytes),
Payloads: []*types.SigningPayload{
{
AccountIdentifier: signingAccount,
Expand All @@ -367,13 +307,8 @@ func (s *ConstructionAPIService) ConstructionCombine(ctx context.Context, reques
return nil, wrapErr(ErrInvalidTransaction, err)
}

var unsignedTxn transactionMetadata
if err := json.Unmarshal(unsignedTxnBytes, &unsignedTxn); err != nil {
return nil, wrapErr(ErrInvalidTransaction, err)
}

desoTxn := &lib.MsgDeSoTxn{}
if err = desoTxn.FromBytes(unsignedTxn.Transaction); err != nil {
if err = desoTxn.FromBytes(unsignedTxnBytes); err != nil {
return nil, wrapErr(ErrInvalidTransaction, err)
}

Expand All @@ -389,19 +324,8 @@ func (s *ConstructionAPIService) ConstructionCombine(ctx context.Context, reques
return nil, wrapErr(ErrInvalidTransaction, err)
}

signedTxn, err := json.Marshal(&transactionMetadata{
Transaction: signedTxnBytes,
InputAmounts: unsignedTxn.InputAmounts,
LegacyUTXOSelection: unsignedTxn.LegacyUTXOSelection,
NoncePartialID: unsignedTxn.NoncePartialID,
NonceExpirationBlockHeight: unsignedTxn.NonceExpirationBlockHeight,
NonceExpirationBlockHeightOffset: unsignedTxn.NonceExpirationBlockHeightOffset,
TxnFeeNanos: unsignedTxn.TxnFeeNanos,
FeeRateNanosPerKB: unsignedTxn.FeeRateNanosPerKB,
})

return &types.ConstructionCombineResponse{
SignedTransaction: hex.EncodeToString(signedTxn),
SignedTransaction: hex.EncodeToString(signedTxnBytes),
}, nil
}

Expand Down Expand Up @@ -429,13 +353,8 @@ func (s *ConstructionAPIService) ConstructionParse(ctx context.Context, request
return nil, wrapErr(ErrInvalidTransaction, err)
}

var metadata transactionMetadata
if err := json.Unmarshal(txnBytes, &metadata); err != nil {
return nil, wrapErr(ErrInvalidTransaction, err)
}

desoTxn := &lib.MsgDeSoTxn{}
if err = desoTxn.FromBytes(metadata.Transaction); err != nil {
if err = desoTxn.FromBytes(txnBytes); err != nil {
return nil, wrapErr(ErrInvalidTransaction, err)
}

Expand All @@ -444,29 +363,30 @@ func (s *ConstructionAPIService) ConstructionParse(ctx context.Context, request
}

numOps := int64(0)
totalInput := desoTxn.TxnFeeNanos
for _, output := range desoTxn.TxOutputs {
totalInput += output.AmountNanos
}
var operations []*types.Operation
operations = append(operations, &types.Operation{
OperationIdentifier: &types.OperationIdentifier{
Index: numOps,
},

for _, inputAmount := range metadata.InputAmounts {
operations = append(operations, &types.Operation{
Type: deso.InputOpType,
OperationIdentifier: &types.OperationIdentifier{
Index: numOps,
},
Account: signer,
Amount: &types.Amount{
Value: inputAmount,
Currency: s.config.Currency,
},
})
numOps += 1
}
Account: &types.AccountIdentifier{
Address: lib.Base58CheckEncode(desoTxn.PublicKey, false, s.node.Params),
},

for _, output := range desoTxn.TxOutputs {
// Skip the change output when NOT using legacy utxo selection
if !metadata.LegacyUTXOSelection && reflect.DeepEqual(output.PublicKey, desoTxn.PublicKey) {
continue
}
Amount: &types.Amount{
Value: strconv.FormatInt(int64(totalInput)*-1, 10),
Currency: &deso.Currency,
},

Type: deso.InputOpType,
})
numOps += 1
for _, output := range desoTxn.TxOutputs {
totalInput += output.AmountNanos
op := &types.Operation{
OperationIdentifier: &types.OperationIdentifier{
Index: numOps,
Expand Down Expand Up @@ -512,13 +432,8 @@ func (s *ConstructionAPIService) ConstructionSubmit(ctx context.Context, request
return nil, wrapErr(ErrInvalidTransaction, err)
}

var txn transactionMetadata
if err := json.Unmarshal(txnBytes, &txn); err != nil {
return nil, wrapErr(ErrInvalidTransaction, err)
}

desoTxn := &lib.MsgDeSoTxn{}
if err = desoTxn.FromBytes(txn.Transaction); err != nil {
if err = desoTxn.FromBytes(txnBytes); err != nil {
return nil, wrapErr(ErrInvalidTransaction, err)
}

Expand Down
29 changes: 0 additions & 29 deletions services/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ type preprocessOptions struct {
// The outputs are used to compute the fee estimate in the metadata portion.
DeSoOutputs []*desoOutput `json:"deso_outputs"`

// Allow legacy manual selection of UTXOs
LegacyUTXOSelection bool `json:"legacy_utxo_selection"` // Deprecated
DeSoInputs []*desoInput `json:"deso_inputs"` // Deprecated

// Values used to set TxnNonce. Note that only one of
// NonceExpirationBlockHeight and NonceExpirationBlockHeightOffset
// should be specified. If both are specified,
Expand Down Expand Up @@ -62,31 +58,6 @@ type constructionMetadata struct {
// final transaction.
DeSoSampleTxnHex string `json:"deso_sample_txn_hex"`

// Allow legacy manual selection of UTXOs
LegacyUTXOSelection bool `json:"legacy_utxo_selection"` // Deprecated

// Values used to set TxnNonce. Note that only one of
// NonceExpirationBlockHeight and NonceExpirationBlockHeightOffset
// should be specified. If both are specified,
// NonceExpirationBlockHeightOffset is used.
NoncePartialID uint64 `json:"nonce_partial_id"`
NonceExpirationBlockHeight uint64 `json:"nonce_expiration_block_height"`
NonceExpirationBlockHeightOffset uint64 `json:"nonce_expiration_block_height_offset"`

// Values used to specify the fee for a transaction. Note that
// only one of FeeRateNanosPerKB and TxnFeeNanos should be specified.
// If both are specified, FeeRateNanosPerKB is used.
FeeRateNanosPerKB uint64 `json:"fee_rate_nanos_per_kb"`
TxnFeeNanos uint64 `json:"txn_fee_nanos"`
}

type transactionMetadata struct {
Transaction []byte `json:"transaction"`
InputAmounts []string `json:"input_amount"`

// Allow legacy manual selection of UTXOs
LegacyUTXOSelection bool `json:"legacy_utxo_selection"` // Deprecated

// Values used to set TxnNonce. Note that only one of
// NonceExpirationBlockHeight and NonceExpirationBlockHeightOffset
// should be specified. If both are specified,
Expand Down