Skip to content

Commit

Permalink
Remove modifications that has been added in separate PR block-core#348
Browse files Browse the repository at this point in the history
  • Loading branch information
sondreb committed Aug 17, 2021
1 parent 9248e77 commit e1bd296
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -699,18 +699,13 @@ public IActionResult BuildTransaction([FromBody] BuildTransactionRequest request
}
}

var (opReturnRawData, isValid) = request.OpReturnDataIsHex ? TryGetHexValue(request.OpReturnData) : (null, true);
if (!isValid)
return ErrorHelpers.BuildErrorResponse(HttpStatusCode.BadRequest, "Hex OpReturn error.", "The OpReturnData is set as a hex value and could not be decoded");

var context = new TransactionBuildContext(this.network)
{
AccountReference = new WalletAccountReference(request.WalletName, request.AccountName),
TransactionFee = string.IsNullOrEmpty(request.FeeAmount) ? null : Money.Parse(request.FeeAmount),
MinConfirmations = request.AllowUnconfirmed ? 0 : 1,
Shuffle = request.ShuffleOutputs ?? true, // We shuffle transaction outputs by default as it's better for anonymity.
OpReturnData = request.OpReturnData,
OpReturnRawData = opReturnRawData,
OpReturnAmount = string.IsNullOrEmpty(request.OpReturnAmount) ? null : Money.Parse(request.OpReturnAmount),
WalletPassword = request.Password,
SelectedInputs = request.Outpoints?.Select(u => new OutPoint(uint256.Parse(u.TransactionId), u.Index)).ToList(),
Expand Down Expand Up @@ -1607,18 +1602,6 @@ private void SyncFromBestHeightForRecoveredWallets(DateTime walletCreationDate)
{
this.walletSyncManager.SyncFromHeight(blockHeightToSyncFrom);
}
}

private (byte[], bool) TryGetHexValue(string hexString)
{
try
{
return (Encoders.Hex.DecodeData(hexString), true);
}
catch
{
return (null, false);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,6 @@ public TxFeeEstimateRequest()
/// </summary>
public string OpReturnData { get; set; }

/// <summary>
/// Sets if the OpReturnData is a hex value and must be decoded
/// </summary>
public bool OpReturnDataIsHex { get; set; }

/// <summary>
/// The funds in STRAT (or a sidechain coin) to include with the OP_RETURN output. Currently, specifying
/// some funds helps OP_RETURN outputs be relayed around the network.
Expand Down

0 comments on commit e1bd296

Please sign in to comment.