public bool TryGetChainUtxoImpl(uint256 genesisBlockHash, ulong utxoId, ref ChainError error, out Script script, out Money amountSatoshi) { script = null; amountSatoshi = null; var shortChannelId = Primitives.ShortChannelId.FromUInt64(utxoId); _logger.LogDebug($"query block by shortchannel id {shortChannelId}"); var b = NbxplorerClient.RPCClient.GetBlock(shortChannelId.BlockHeight.Item); if (b.Transactions.Count < shortChannelId.BlockIndex.Item) { _logger.LogError($"Tx not found in block {shortChannelId.BlockHeight.Item}. block index was{shortChannelId.BlockIndex.Item}. but actual tx number in block is {b.Transactions.Count}"); error = ChainError.UnknownTx; return(false); } var tx = b.Transactions[(int)shortChannelId.BlockIndex.Item]; if (tx.Outputs.Count < shortChannelId.TxOutIndex.Item) { _logger.LogError($"Tx not found in block {shortChannelId.BlockHeight.Item}. txout index was {shortChannelId.TxOutIndex.Item}. but actual tx number of txout is {tx.Outputs.Count}"); error = ChainError.UnknownTx; return(false); } var txOut = tx.Outputs[shortChannelId.TxOutIndex.Item]; script = txOut.ScriptPubKey; amountSatoshi = (ulong)txOut.Value.Satoshi; return(true); }
public bool TryGetChainUtxoImpl(uint256 genesisBlockHash, ulong utxoId, ref ChainError error, out Script scriptPubKey, out Money amount) { error = ChainError.NotWatched; scriptPubKey = null; amount = null; return(false); }
bool IChainWatchInterface.TryGetChainUtxoImpl(uint256 genesisBlockHash, ulong utxoId, ref ChainError error, out Script scriptPubKey, out Money amount) { throw new NotSupportedException(); }
public ChainErrorException(ChainError error) : base(error.ToString()) { }
public ChainErrorException(ChainError error, Exception innerException) : base(error.ToString(), innerException) { }