/// <exception cref="BitCoinSharp.VerificationException" /> private void SendTransactionsToWallet(StoredBlock block, NewBlockType blockType, IEnumerable <Transaction> newTransactions) { // Scan the transactions to find out if any mention addresses we own. foreach (var tx in newTransactions) { try { ScanTransaction(block, tx, blockType); } catch (ScriptException e) { // We don't want scripts we don't understand to break the block chain, // so just note that this tx was not scanned here and continue. _log.WarnFormat("Failed to parse a script: {0}", e); } } }
/// <exception cref="VerificationException"/> private static void SendTransactionsToWallet(StoredBlock block, NewBlockType blockType, IEnumerable <KeyValuePair <Wallet, List <Transaction> > > newTransactions) { foreach (var item in newTransactions) { try { foreach (var tx in item.Value) { item.Key.Receive(tx, block, blockType); } } catch (ScriptException e) { // We don't want scripts we don't understand to break the block chain so just note that this tx was // not scanned here and continue. _log.WarnFormat("Failed to parse a script: {0}", e); } } }
/// <exception cref="BitCoinSharp.ScriptException" /> /// <exception cref="BitCoinSharp.VerificationException" /> private void ScanTransaction(StoredBlock block, Transaction tx, NewBlockType blockType) { var shouldReceive = false; foreach (var output in tx.Outputs) { // TODO: Handle more types of outputs, not just regular to address outputs. if (output.ScriptPubKey.IsSentToIp) { return; } // This is not thread safe as a key could be removed between the call to isMine and receive. if (output.IsMine(_wallet)) { shouldReceive = true; } } // Coinbase transactions don't have anything useful in their inputs (as they create coins out of thin air). if (!tx.IsCoinBase) { foreach (var i in tx.Inputs) { var pubkey = i.ScriptSig.PubKey; // This is not thread safe as a key could be removed between the call to isPubKeyMine and receive. if (_wallet.IsPubKeyMine(pubkey)) { shouldReceive = true; } } } if (shouldReceive) { _wallet.Receive(tx, block, blockType); } }
/// <exception cref="VerificationException"/> private static void SendTransactionsToWallet(StoredBlock block, NewBlockType blockType, IDictionary<Wallet, List<Transaction>> newTransactions) { foreach (var item in newTransactions) { try { foreach (var tx in item.Value) { item.Key.Receive(tx, block, blockType); } } catch (ScriptException e) { // We don't want scripts we don't understand to break the block chain so just note that this tx was // not scanned here and continue. _log.WarnFormat("Failed to parse a script: {0}", e); } } }
/// <exception cref="BitCoinSharp.VerificationException" /> private void SendTransactionsToWallet(StoredBlock block, NewBlockType blockType, IEnumerable<Transaction> newTransactions) { // Scan the transactions to find out if any mention addresses we own. foreach (var tx in newTransactions) { try { ScanTransaction(block, tx, blockType); } catch (ScriptException e) { // We don't want scripts we don't understand to break the block chain, // so just note that this tx was not scanned here and continue. _log.WarnFormat("Failed to parse a script: {0}", e); } } }
/// <exception cref="BitCoinSharp.ScriptException" /> /// <exception cref="BitCoinSharp.VerificationException" /> private void ScanTransaction(StoredBlock block, Transaction tx, NewBlockType blockType) { var shouldReceive = false; foreach (var output in tx.Outputs) { // TODO: Handle more types of outputs, not just regular to address outputs. if (output.ScriptPubKey.IsSentToIp) return; // This is not thread safe as a key could be removed between the call to isMine and receive. if (output.IsMine(_wallet)) { shouldReceive = true; } } // Coinbase transactions don't have anything useful in their inputs (as they create coins out of thin air). if (!tx.IsCoinBase) { foreach (var i in tx.Inputs) { var pubkey = i.ScriptSig.PubKey; // This is not thread safe as a key could be removed between the call to isPubKeyMine and receive. if (_wallet.IsPubKeyMine(pubkey)) { shouldReceive = true; } } } if (shouldReceive) _wallet.Receive(tx, block, blockType); }