forked from MetacoSA/NBitcoin
-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Description
The problem appears to be that the interim wallet does not accept nulldata transactions with a value of 0. The NStratis TransactionBuilder verification regards them as valid.
Sample code that exhibits the problem (when the overridden transaction is submitted to the RPC server the 0.0001 assigned to the nulldata seems to get reassigned to the staking fees):
Transaction sourceTx = rpc.GetRawTransaction(uint256.Parse("d2401ed79279d909fc84b0f89bbec694eff576b9541cc70c717f640238719aef"));
BitcoinSecret sourcePrivateKey = new BitcoinSecret("xxx", Network.StratisMain);
var issuance = new IssuanceCoin(new OutPoint(sourceTx, 0), sourceTx.Outputs[0]);
var dest = BitcoinAddress.Create("SesDUTF3sdqC8mTfW9vJFQMeQGw6dv8Dzz");
TransactionBuilder builder = new TransactionBuilder();
var tx = builder
.AddKeys(sourcePrivateKey)
.AddCoins(issuance)
.IssueAsset(dest, new AssetMoney(issuance.AssetId, quantity: 10))
.SendFees(Money.Coins(0.001m))
.SetChange(sourcePrivateKey.PubKey)
.BuildTransaction(true);
TransactionPolicyError[] errorsfound = null;
// The transaction is rejected by the interim wallet's RPC server
// unless the output values are manually changed to make the nulldata
// transaction have a non-zero value:
tx.Outputs[1].Value = Money.Coins(1.79777270m);
tx.Outputs[2].Value = Money.Coins(0.0001m);
builder.SignTransactionInPlace(tx);
bool result = builder.Verify(tx, out errorsfound);Metadata
Metadata
Assignees
Labels
No labels