Java Code Examples for org.bitcoinj.core.BlockChain#NewBlockType

The following examples show how to use org.bitcoinj.core.BlockChain#NewBlockType . 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: SPV.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void receiveFromBlock(final Transaction tx, final StoredBlock block,
                             final BlockChain.NewBlockType blockType,
                             final int relativityOffset) throws VerificationException {
    if (tx == null)
        throw new RuntimeException("receiveFromBlock got null tx");
    Log.d(TAG, "receiveFromBlock " + tx.getHash().toString());
    addUtxoToValues(tx.getHash(), true);
}
 
Example 2
Source File: SPV.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean notifyTransactionIsInBlock(final Sha256Hash txHash, final StoredBlock block,
                                          final BlockChain.NewBlockType blockType,
                                          final int relativityOffset) throws VerificationException {
    Log.d(TAG, "notifyTransactionIsInBlock " + txHash.toString());
    return isUnspentOutpoint(txHash);
}
 
Example 3
Source File: SPV.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void receiveFromBlock(final Transaction tx, final StoredBlock block,
                             final BlockChain.NewBlockType blockType,
                             final int relativityOffset) throws VerificationException {
    if (tx == null)
        throw new RuntimeException("receiveFromBlock got null tx");
    getService().notifyObservers(tx.getHash());
}
 
Example 4
Source File: SPV.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean notifyTransactionIsInBlock(final Sha256Hash txHash, final StoredBlock block, final BlockChain.NewBlockType blockType, final int relativityOffset) throws VerificationException {
    getService().notifyObservers(txHash);
    return isUnspentOutpoint(txHash);
}
 
Example 5
Source File: TransactionReceivedInBlockListener.java    From bcm-android with GNU General Public License v3.0 2 votes vote down vote up
/**
 * <p>Called by the {@link BlockChain} when we receive a new block that contains a relevant transaction.</p>
 * <p>
 * <p>A transaction may be received multiple times if is included into blocks in parallel chains. The blockType
 * parameter describes whether the containing block is on the main/best chain or whether it's on a presently
 * inactive side chain.</p>
 * <p>
 * <p>The relativityOffset parameter is an arbitrary number used to establish an ordering between transactions
 * within the same block. In the case where full blocks are being downloaded, it is simply the index of the
 * transaction within that block. When Bloom filtering is in use, we don't find out the exact offset into a block
 * that a transaction occurred at, so the relativity count is not reflective of anything in an absolute sense but
 * rather exists only to order the transaction relative to the others.</p>
 */
void receiveFromBlock(Transaction tx, StoredBlock block,
                      BlockChain.NewBlockType blockType,
                      int relativityOffset) throws VerificationException;
 
Example 6
Source File: TransactionReceivedInBlockListener.java    From bcm-android with GNU General Public License v3.0 2 votes vote down vote up
/**
 * <p>Called by the {@link BlockChain} when we receive a new {@link FilteredBlock} that contains the given
 * transaction hash in its merkle tree.</p>
 * <p>
 * <p>A transaction may be received multiple times if is included into blocks in parallel chains. The blockType
 * parameter describes whether the containing block is on the main/best chain or whether it's on a presently
 * inactive side chain.</p>
 * <p>
 * <p>The relativityOffset parameter in this case is an arbitrary (meaningless) number, that is useful only when
 * compared to the relativity count of another transaction received inside the same block. It is used to establish
 * an ordering of transactions relative to one another.</p>
 * <p>
 * <p>This method should return false if the given tx hash isn't known about, e.g. because the the transaction was
 * a Bloom false positive. If it was known about and stored, it should return true. The caller may need to know
 * this to calculate the effective FP rate.</p>
 *
 * @return whether the transaction is known about i.e. was considered relevant previously.
 */
boolean notifyTransactionIsInBlock(Sha256Hash txHash, StoredBlock block,
                                   BlockChain.NewBlockType blockType,
                                   int relativityOffset) throws VerificationException;
 
Example 7
Source File: TransactionReceivedInBlockListener.java    From green_android with GNU General Public License v3.0 2 votes vote down vote up
/**
 * <p>Called by the {@link BlockChain} when we receive a new block that contains a relevant transaction.</p>
 *
 * <p>A transaction may be received multiple times if is included into blocks in parallel chains. The blockType
 * parameter describes whether the containing block is on the main/best chain or whether it's on a presently
 * inactive side chain.</p>
 *
 * <p>The relativityOffset parameter is an arbitrary number used to establish an ordering between transactions
 * within the same block. In the case where full blocks are being downloaded, it is simply the index of the
 * transaction within that block. When Bloom filtering is in use, we don't find out the exact offset into a block
 * that a transaction occurred at, so the relativity count is not reflective of anything in an absolute sense but
 * rather exists only to order the transaction relative to the others.</p>
 */
void receiveFromBlock(Transaction tx, StoredBlock block,
                      BlockChain.NewBlockType blockType,
                      int relativityOffset) throws VerificationException;
 
Example 8
Source File: TransactionReceivedInBlockListener.java    From green_android with GNU General Public License v3.0 2 votes vote down vote up
/**
 * <p>Called by the {@link BlockChain} when we receive a new {@link FilteredBlock} that contains the given
 * transaction hash in its merkle tree.</p>
 *
 * <p>A transaction may be received multiple times if is included into blocks in parallel chains. The blockType
 * parameter describes whether the containing block is on the main/best chain or whether it's on a presently
 * inactive side chain.</p>
 *
 * <p>The relativityOffset parameter in this case is an arbitrary (meaningless) number, that is useful only when
 * compared to the relativity count of another transaction received inside the same block. It is used to establish
 * an ordering of transactions relative to one another.</p>
 *
 * <p>This method should return false if the given tx hash isn't known about, e.g. because the the transaction was
 * a Bloom false positive. If it was known about and stored, it should return true. The caller may need to know
 * this to calculate the effective FP rate.</p>
 *
 * @return whether the transaction is known about i.e. was considered relevant previously.
 */
boolean notifyTransactionIsInBlock(Sha256Hash txHash, StoredBlock block,
                                   BlockChain.NewBlockType blockType,
                                   int relativityOffset) throws VerificationException;
 
Example 9
Source File: TransactionReceivedInBlockListener.java    From GreenBits with GNU General Public License v3.0 2 votes vote down vote up
/**
 * <p>Called by the {@link BlockChain} when we receive a new block that contains a relevant transaction.</p>
 *
 * <p>A transaction may be received multiple times if is included into blocks in parallel chains. The blockType
 * parameter describes whether the containing block is on the main/best chain or whether it's on a presently
 * inactive side chain.</p>
 *
 * <p>The relativityOffset parameter is an arbitrary number used to establish an ordering between transactions
 * within the same block. In the case where full blocks are being downloaded, it is simply the index of the
 * transaction within that block. When Bloom filtering is in use, we don't find out the exact offset into a block
 * that a transaction occurred at, so the relativity count is not reflective of anything in an absolute sense but
 * rather exists only to order the transaction relative to the others.</p>
 */
void receiveFromBlock(Transaction tx, StoredBlock block,
                      BlockChain.NewBlockType blockType,
                      int relativityOffset) throws VerificationException;
 
Example 10
Source File: TransactionReceivedInBlockListener.java    From GreenBits with GNU General Public License v3.0 2 votes vote down vote up
/**
 * <p>Called by the {@link BlockChain} when we receive a new {@link FilteredBlock} that contains the given
 * transaction hash in its merkle tree.</p>
 *
 * <p>A transaction may be received multiple times if is included into blocks in parallel chains. The blockType
 * parameter describes whether the containing block is on the main/best chain or whether it's on a presently
 * inactive side chain.</p>
 *
 * <p>The relativityOffset parameter in this case is an arbitrary (meaningless) number, that is useful only when
 * compared to the relativity count of another transaction received inside the same block. It is used to establish
 * an ordering of transactions relative to one another.</p>
 *
 * <p>This method should return false if the given tx hash isn't known about, e.g. because the the transaction was
 * a Bloom false positive. If it was known about and stored, it should return true. The caller may need to know
 * this to calculate the effective FP rate.</p>
 *
 * @return whether the transaction is known about i.e. was considered relevant previously.
 */
boolean notifyTransactionIsInBlock(Sha256Hash txHash, StoredBlock block,
                                   BlockChain.NewBlockType blockType,
                                   int relativityOffset) throws VerificationException;