当前位置: 首页>>代码示例>>C#>>正文


C# Transaction.GetValueSentFromMe方法代码示例

本文整理汇总了C#中Transaction.GetValueSentFromMe方法的典型用法代码示例。如果您正苦于以下问题:C# Transaction.GetValueSentFromMe方法的具体用法?C# Transaction.GetValueSentFromMe怎么用?C# Transaction.GetValueSentFromMe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Transaction的用法示例。


在下文中一共展示了Transaction.GetValueSentFromMe方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestBalances

 public void TestBalances()
 {
     var nanos = Utils.ToNanoCoins(1, 0);
     var tx1 = CreateFakeTx(nanos, _myAddress);
     _wallet.Receive(tx1, null, BlockChain.NewBlockType.BestChain);
     Assert.AreEqual(nanos, tx1.GetValueSentToMe(_wallet, true));
     // Send 0.10 to somebody else.
     var send1 = _wallet.CreateSend(new EcKey().ToAddress(_params), Utils.ToNanoCoins(0, 10), _myAddress);
     // Re-serialize.
     var send2 = new Transaction(_params, send1.BitcoinSerialize());
     Assert.AreEqual(nanos, send2.GetValueSentFromMe(_wallet));
 }
开发者ID:aklein53,项目名称:bitcoinsharp,代码行数:12,代码来源:WalletTest.cs

示例2: Transactions

 public void Transactions()
 {
     // This test covers a bug in which Transaction.getValueSentFromMe was calculating incorrectly.
     var tx = TestUtils.CreateFakeTx(_params, Utils.ToNanoCoins(1, 0), _myAddress);
     // Now add another output (ie, change) that goes to some other address.
     var someOtherGuy = new EcKey().ToAddress(_params);
     var output = new TransactionOutput(_params, tx, Utils.ToNanoCoins(0, 5), someOtherGuy);
     tx.AddOutput(output);
     // Note that tx is no longer valid: it spends more than it imports. However checking transactions balance
     // correctly isn't possible in SPV mode because value is a property of outputs not inputs. Without all
     // transactions you can't check they add up.
     _wallet.Receive(tx, null, BlockChain.NewBlockType.BestChain);
     // Now the other guy creates a transaction which spends that change.
     var tx2 = new Transaction(_params);
     tx2.AddInput(output);
     tx2.AddOutput(new TransactionOutput(_params, tx2, Utils.ToNanoCoins(0, 5), _myAddress));
     // tx2 doesn't send any coins from us, even though the output is in the wallet.
     Assert.AreEqual(Utils.ToNanoCoins(0, 0), tx2.GetValueSentFromMe(_wallet));
 }
开发者ID:Tsunami-ide,项目名称:Bitcoin,代码行数:19,代码来源:WalletTest.cs


注:本文中的Transaction.GetValueSentFromMe方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。