예제 #1
0
파일: Vote.java 프로젝트: andriybobyr/lnk
 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();
 }
예제 #2
0
파일: Vote.java 프로젝트: andriybobyr/lnk
 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");
 }
예제 #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;
 }
예제 #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");
 }
예제 #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();
 }
예제 #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;
 }
예제 #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));
 }
예제 #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");
 }
예제 #9
0
파일: Vote.java 프로젝트: andriybobyr/lnk
 public static Vote getVote(long id) {
   return voteTable.get(voteDbKeyFactory.newKey(id));
 }
예제 #10
0
 public static Asset getAsset(long id) {
   return assetTable.get(assetDbKeyFactory.newKey(id));
 }
예제 #11
0
 public static RewardRecipientAssignment getRewardRecipientAssignment(Long id) {
   return rewardRecipientAssignmentTable.get(rewardRecipientAssignmentDbKeyFactory.newKey(id));
 }
예제 #12
0
 public static Account getAccount(long id, int height) {
   return id == 0 ? null : accountTable.get(accountDbKeyFactory.newKey(id), height);
 }