org.bitcoinj.core.FilteredBlock Java Examples

The following examples show how to use org.bitcoinj.core.FilteredBlock. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DownloadProgressTracker.java    From bcm-android with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onBlocksDownloaded(Peer peer, Block block, @Nullable FilteredBlock filteredBlock, int blocksLeft) {
    if (caughtUp)
        return;

    if (blocksLeft == 0) {
        caughtUp = true;
        doneDownload();
        future.set(peer.getBestHeight());
    }

    if (blocksLeft < 0 || originalBlocksLeft <= 0)
        return;

    double pct = 100.0 - (100.0 * (blocksLeft / (double) originalBlocksLeft));
    if ((int) pct != lastPercent) {
        progress(pct, blocksLeft, new Date(block.getTimeSeconds() * 1000));
        lastPercent = (int) pct;
    }
}
 
Example #2
Source File: DownloadProgressTracker.java    From green_android with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onBlocksDownloaded(Peer peer, Block block, @Nullable FilteredBlock filteredBlock, int blocksLeft) {
    if (caughtUp)
        return;

    if (blocksLeft == 0) {
        caughtUp = true;
        if (lastPercent != 100) {
            lastPercent = 100;
            progress(lastPercent, blocksLeft, new Date(block.getTimeSeconds() * 1000));
        }
        doneDownload();
        future.set(peer.getBestHeight());
        return;
    }

    if (blocksLeft < 0 || originalBlocksLeft <= 0)
        return;

    double pct = 100.0 - (100.0 * (blocksLeft / (double) originalBlocksLeft));
    if ((int) pct != lastPercent) {
        progress(pct, blocksLeft, new Date(block.getTimeSeconds() * 1000));
        lastPercent = (int) pct;
    }
}
 
Example #3
Source File: DownloadProgressTracker.java    From GreenBits with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onBlocksDownloaded(Peer peer, Block block, @Nullable FilteredBlock filteredBlock, int blocksLeft) {
    if (caughtUp)
        return;

    if (blocksLeft == 0) {
        caughtUp = true;
        if (lastPercent != 100) {
            lastPercent = 100;
            progress(lastPercent, blocksLeft, new Date(block.getTimeSeconds() * 1000));
        }
        doneDownload();
        future.set(peer.getBestHeight());
        return;
    }

    if (blocksLeft < 0 || originalBlocksLeft <= 0)
        return;

    double pct = 100.0 - (100.0 * (blocksLeft / (double) originalBlocksLeft));
    if ((int) pct != lastPercent) {
        progress(pct, blocksLeft, new Date(block.getTimeSeconds() * 1000));
        lastPercent = (int) pct;
    }
}
 
Example #4
Source File: AbstractPeerEventListener.java    From bcm-android with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onBlocksDownloaded(Peer peer, Block block, @Nullable FilteredBlock filteredBlock, int blocksLeft) {
}
 
Example #5
Source File: AbstractPeerEventListener.java    From green_android with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onBlocksDownloaded(Peer peer, Block block, @Nullable FilteredBlock filteredBlock, int blocksLeft) {
}
 
Example #6
Source File: AbstractPeerEventListener.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onBlocksDownloaded(Peer peer, Block block, @Nullable FilteredBlock filteredBlock, int blocksLeft) {
}
 
Example #7
Source File: Network.java    From cate with MIT License 4 votes vote down vote up
protected void onBlocksDownloadedEventListener(Peer peer, Block block, FilteredBlock filteredBlock, int blocksLeft) {
    this.blocksLeft.set(blocksLeft);
}
 
Example #8
Source File: ImportEventListener.java    From jelectrum with MIT License 4 votes vote down vote up
@Override
public void onBlocksDownloaded(Peer peer, Block block, FilteredBlock fblock, int blocksLeft)
{
    importer.saveBlock(block);

}