Exemplo n.º 1
0
  public boolean sendCoinsMulti(Map<Address, Double> toSend) {
    Transaction tx = new Transaction(Craftcoinish.network);
    double totalSend = 0.0;

    for (Entry<Address, Double> current : toSend.entrySet()) {
      totalSend += current.getValue() / Craftcoinish.mult;
      tx.addOutput(Craftcoinish.econ.inGameToBitcoin(current.getValue()), current.getKey());
    }

    if (totalSend < 0.01) {
      return false;
    }

    Wallet.SendRequest request = Wallet.SendRequest.forTx(tx);

    if (!localWallet.completeTx(request)) {
      return false;
    } else {
      localPeerGroup.broadcastTransaction(request.tx);
      try {
        localWallet.commitTx(request.tx);
      } catch (VerificationException e) {
        e.printStackTrace();
      }
      return true;
    }
  }