Esempio n. 1
0
 private Vote(Transaction transaction, Attachment.MessagingVoteCasting attachment) {
   this.id = transaction.getId();
   this.dbKey = voteDbKeyFactory.newKey(this.id);
   this.pollId = attachment.getPollId();
   this.voterId = transaction.getSenderId();
   this.voteBytes = attachment.getPollVote();
 }
Esempio n. 2
0
 private Vote(ResultSet rs) throws SQLException {
   this.id = rs.getLong("id");
   this.dbKey = voteDbKeyFactory.newKey(this.id);
   this.pollId = rs.getLong("poll_id");
   this.voterId = rs.getLong("voter_id");
   this.voteBytes = rs.getBytes("vote_bytes");
 }
Esempio n. 3
0
 static Account addOrGetAccount(long id) {
   Account account = accountTable.get(accountDbKeyFactory.newKey(id));
   if (account == null) {
     account = new Account(id);
     accountTable.insert(account);
   }
   return account;
 }
Esempio n. 4
0
 private Asset(ResultSet rs) throws SQLException {
   this.assetId = rs.getLong("id");
   this.dbKey = assetDbKeyFactory.newKey(this.assetId);
   this.accountId = rs.getLong("account_id");
   this.name = rs.getString("name");
   this.description = rs.getString("description");
   this.quantityQNT = rs.getLong("quantity");
   this.decimals = rs.getByte("decimals");
 }
Esempio n. 5
0
 private Asset(Transaction transaction, Attachment.ColoredCoinsAssetIssuance attachment) {
   this.assetId = transaction.getId();
   this.dbKey = assetDbKeyFactory.newKey(this.assetId);
   this.accountId = transaction.getSenderId();
   this.name = attachment.getName();
   this.description = attachment.getDescription();
   this.quantityQNT = attachment.getQuantityQNT();
   this.decimals = attachment.getDecimals();
 }
Esempio n. 6
0
 private Account(long id) {
   if (id != Crypto.rsDecode(Crypto.rsEncode(id))) {
     Logger.logMessage("CRITICAL ERROR: Reed-Solomon encoding fails for " + id);
   }
   this.id = id;
   this.dbKey = accountDbKeyFactory.newKey(this.id);
   this.creationHeight = Nxt.getBlockchain().getHeight();
   currentLeasingHeightFrom = Integer.MAX_VALUE;
 }
Esempio n. 7
0
 public static Account getAccount(byte[] publicKey) {
   Account account = accountTable.get(accountDbKeyFactory.newKey(getId(publicKey)));
   if (account == null) {
     return null;
   }
   if (account.getPublicKey() == null || Arrays.equals(account.getPublicKey(), publicKey)) {
     return account;
   }
   throw new RuntimeException(
       "DUPLICATE KEY for account "
           + Convert.toUnsignedLong(account.getId())
           + " existing key "
           + Convert.toHexString(account.getPublicKey())
           + " new key "
           + Convert.toHexString(publicKey));
 }
Esempio n. 8
0
 private Account(ResultSet rs) throws SQLException {
   this.id = rs.getLong("id");
   this.dbKey = accountDbKeyFactory.newKey(this.id);
   this.creationHeight = rs.getInt("creation_height");
   this.publicKey = rs.getBytes("public_key");
   this.keyHeight = rs.getInt("key_height");
   this.balanceNQT = rs.getLong("balance");
   this.unconfirmedBalanceNQT = rs.getLong("unconfirmed_balance");
   this.forgedBalanceNQT = rs.getLong("forged_balance");
   this.name = rs.getString("name");
   this.description = rs.getString("description");
   this.currentLeasingHeightFrom = rs.getInt("current_leasing_height_from");
   this.currentLeasingHeightTo = rs.getInt("current_leasing_height_to");
   this.currentLesseeId = rs.getLong("current_lessee_id");
   this.nextLeasingHeightFrom = rs.getInt("next_leasing_height_from");
   this.nextLeasingHeightTo = rs.getInt("next_leasing_height_to");
   this.nextLesseeId = rs.getLong("next_lessee_id");
 }
Esempio n. 9
0
 public static Vote getVote(long id) {
   return voteTable.get(voteDbKeyFactory.newKey(id));
 }
Esempio n. 10
0
 public static Asset getAsset(long id) {
   return assetTable.get(assetDbKeyFactory.newKey(id));
 }
Esempio n. 11
0
 public static RewardRecipientAssignment getRewardRecipientAssignment(Long id) {
   return rewardRecipientAssignmentTable.get(rewardRecipientAssignmentDbKeyFactory.newKey(id));
 }
Esempio n. 12
0
 public static Account getAccount(long id, int height) {
   return id == 0 ? null : accountTable.get(accountDbKeyFactory.newKey(id), height);
 }