本文整理汇总了Java中com.bitsofproof.supernode.api.BCSAPIException类的典型用法代码示例。如果您正苦于以下问题:Java BCSAPIException类的具体用法?Java BCSAPIException怎么用?Java BCSAPIException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BCSAPIException类属于com.bitsofproof.supernode.api包,在下文中一共展示了BCSAPIException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scanTransactionsForAddresses
import com.bitsofproof.supernode.api.BCSAPIException; //导入依赖的package包/类
@Override
public void scanTransactionsForAddresses (Set<Address> addresses, long after, TransactionListener listener) throws BCSAPIException
{
List<byte[]> al = new ArrayList<> (addresses.size ());
for ( Address a : addresses )
{
try
{
al.add (a.getAddressScript ());
}
catch ( ValidationException e )
{
}
}
scanRequest (al, after, listener, "matchRequest");
}
示例2: scanUTXOForAddresses
import com.bitsofproof.supernode.api.BCSAPIException; //导入依赖的package包/类
@Override
public void scanUTXOForAddresses (Set<Address> addresses, TransactionListener listener) throws BCSAPIException
{
List<byte[]> al = new ArrayList<> (addresses.size ());
for ( Address a : addresses )
{
try
{
al.add (a.getAddressScript ());
}
catch ( ValidationException e )
{
}
}
scanRequest (al, 0, listener, "utxoMatchRequest");
}
示例3: updateTransaction
import com.bitsofproof.supernode.api.BCSAPIException; //导入依赖的package包/类
@Path ("/{txId}")
@PUT
public Response updateTransaction (@PathParam ("txId") UUID id, PendingTransaction transaction)
{
if ( !id.equals (transaction.getId ()) )
{
return Response.notModified ().build ();
}
try
{
vault.updateTransaction (api, transaction);
}
catch ( BCSAPIException | ValidationException e )
{
return Response.serverError ().build ();
}
return Response.ok ().build ();
}
示例4: Vault
import com.bitsofproof.supernode.api.BCSAPIException; //导入依赖的package包/类
public Vault (Map<String, String> keys) throws BCSAPIException, ValidationException
{
for ( Map.Entry<String, String> keyEntry : keys.entrySet () )
{
publicKeys.put (keyEntry.getKey (), new ECPublicKey (ByteUtils.fromHexString (keyEntry.getValue ()), true));
}
log.info ("Vault address: " + getVaultAddress ());
this.accountManager = new AM ();
accountManager.setCreated (new DateTime (2013, 12, 1, 0, 0).getMillis ());
accountManager.addAccountListener (new AccountListener ()
{
@Override
public void accountChanged (AccountManager account, Transaction t)
{
log.info ("New account balance " + fromSatoshi (account.getBalance ()) + " " +
fromSatoshi (account.getConfirmed ()) + " confrirmed " +
fromSatoshi (account.getChange ()) + " change " +
fromSatoshi (account.getReceiving ()) + " receiving");
}
});
}
示例5: updateTransaction
import com.bitsofproof.supernode.api.BCSAPIException; //导入依赖的package包/类
public void updateTransaction (BCSAPI api, PendingTransaction transaction) throws BCSAPIException, ValidationException
{
transaction.setSignedBy (getSignedBy (transaction.getTransaction ()));
if ( transaction.getSignedBy ().size () > 0 )
{
pendingTransactions.put (transaction.getId (), transaction);
try
{
transaction.getTransaction ().computeHash ();
log.info ("Updated " + transaction.getId () + " to " + transaction.getTransaction ().getHash ());
if ( getSignedBy (transaction.getTransaction ()).size () >= 2 )
{
api.sendTransaction (transaction.getTransaction ());
log.info ("Successfully sent " + transaction.getTransaction ().getHash ());
log.info ("transaction: " + transaction.getTransaction ().toWireDump ());
pendingTransactions.remove (transaction.getId ());
}
}
catch ( BCSAPIException e )
{
log.info ("Transaction rejected " + transaction.getTransaction ().getHash ());
throw e;
}
}
}
示例6: isProduction
import com.bitsofproof.supernode.api.BCSAPIException; //导入依赖的package包/类
@Override
public boolean isProduction () throws BCSAPIException
{
if ( production != null )
{
return production;
}
return production = getBlockHeader ("000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f") != null;
}
示例7: processRequest
import com.bitsofproof.supernode.api.BCSAPIException; //导入依赖的package包/类
public void processRequest (String requestId)
{
try
{
BopShopPaymentRequest request = retrieveRequest (requestId);
processParsedRequest (request);
}
catch ( BCSAPIException | ValidationException | IOException e )
{
log.error ("Error processing ticket payment", e);
}
}
示例8: processCleared
import com.bitsofproof.supernode.api.BCSAPIException; //导入依赖的package包/类
public BopShopResource processCleared () throws JsonParseException, JsonMappingException, ClientProtocolException, UnsupportedEncodingException,
IOException, ValidationException, BCSAPIException
{
HttpGet get = new HttpGet ("https://api.bitsofproof.com/mbs/1/paymentRequest?state=CLEARED");
ObjectMapper mapper = new ObjectMapper ();
try
{
BopShopRequestList list = mapper.readValue (executeGet (get), BopShopRequestList.class);
if ( list.get_embedded () != null )
{
Object item = list.get_embedded ().get ("item");
if ( item instanceof List )
{
for ( Map<String, Object> o : (ArrayList<Map<String, Object>>) item )
{
processOneCleared (o);
}
}
else
{
processOneCleared ((Map<String, Object>) item);
}
}
}
catch ( Exception e )
{
log.warn ("Can not get cleared requests list", e);
}
return this;
}
示例9: sync
import com.bitsofproof.supernode.api.BCSAPIException; //导入依赖的package包/类
@Override
public void sync (BCSAPI api) throws BCSAPIException
{
reset ();
api.scanUTXOForAddresses (getAddresses (), new TransactionListener ()
{
@Override
public boolean process (Transaction t)
{
return updateWithTransaction (t);
}
});
}
示例10: syncHistory
import com.bitsofproof.supernode.api.BCSAPIException; //导入依赖的package包/类
@Override
public void syncHistory (BCSAPI api) throws BCSAPIException
{
reset ();
api.scanTransactionsForAddresses (getAddresses (), getCreated (), new TransactionListener ()
{
@Override
public boolean process (Transaction t)
{
return updateWithTransaction (t);
}
});
}
示例11: run
import com.bitsofproof.supernode.api.BCSAPIException; //导入依赖的package包/类
public void run() {
String previousHash = chain.getGenesis().getHash();
for (int blockHeight = 1; blockHeight <= nblocks; ++blockHeight) {
try {
Block block = prepareBlockToMine(previousHash, blockHeight);
mineBlock(block);
previousHash = block.getHash();
getApi().sendBlock(block);
} catch (ValidationException | BCSAPIException e) {
log.error("Server in a box ", e);
}
}
}
示例12: scanTransactions
import com.bitsofproof.supernode.api.BCSAPIException; //导入依赖的package包/类
@Override
public void scanTransactions (ExtendedKey master, int firstIndex, int lookAhead, long after, final TransactionListener listener) throws BCSAPIException
{
scanRequest (master, firstIndex, lookAhead, after, listener, "accountRequest");
}
示例13: createVault
import com.bitsofproof.supernode.api.BCSAPIException; //导入依赖的package包/类
public Vault createVault () throws ValidationException, BCSAPIException
{
Vault vault = new Vault (keys);
return vault;
}
示例14: start
import com.bitsofproof.supernode.api.BCSAPIException; //导入依赖的package包/类
public void start() throws IOException, ValidationException,
BCSAPIException, InterruptedException {
box = new SuperNodeApiTester(new MinerTestChain());
run();
}
示例15: main
import com.bitsofproof.supernode.api.BCSAPIException; //导入依赖的package包/类
public static void main(String[] args) throws IOException,
ValidationException, BCSAPIException, InterruptedException {
InABoxTest st = new InABoxTest();
st.start();
}