Commit 065a6810 authored by Dan Gershony's avatar Dan Gershony Committed by GitHub

Merge pull request #97 from bokobza/master

Added call to walletManager Initialize in the lightwallet feature
parents 9145a6ef 6e82396e
......@@ -9,15 +9,18 @@ namespace Breeze.Wallet
public class LightWalletFeature : FullNodeFeature
{
private readonly IWalletSyncManager walletSyncManager;
private readonly IWalletManager walletManager;
public LightWalletFeature(IWalletSyncManager walletSyncManager)
public LightWalletFeature(IWalletSyncManager walletSyncManager, IWalletManager walletManager)
{
this.walletSyncManager = walletSyncManager;
this.walletManager = walletManager;
}
public override void Start()
{
this.walletSyncManager.Initialize();
this.walletManager.Initialize();
}
public override void Stop()
......
......@@ -103,11 +103,22 @@ namespace Breeze.Wallet
this.blockNotification.SyncFrom(this.chain.GetBlock(height).HashBlock);
}
/// <inheritdoc />
public void ProcessBlock(Block block)
{
var chainedBlock = this.chain.GetBlock(block.GetHash());
// if the newly received block is too far forward, ignore it (for example when we start receiving blocks before the wallets start their syncing)
if (chainedBlock.Height > this.walletManager.LastBlockHeight() + 1)
{
this.logger.LogDebug($"block received with height: {chainedBlock.Height} and hash: {block.Header.GetHash()} is too far in advance. Ignoring.");
return;
}
this.walletManager.ProcessBlock(block);
}
/// <inheritdoc />
public void ProcessTransaction(Transaction transaction)
{
this.walletManager.ProcessTransaction(transaction);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment