Skip to content

Commit

Permalink
Adding testSimpleTransaction() and testMultiSigTransaction() for test
Browse files Browse the repository at this point in the history
  • Loading branch information
githubsrki committed Mar 27, 2018
1 parent a75aeea commit 0772f0e
Show file tree
Hide file tree
Showing 6 changed files with 255 additions and 42 deletions.
6 changes: 3 additions & 3 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.compiler.source=1.8
3 changes: 1 addition & 2 deletions .settings/org.eclipse.wst.common.project.facet.core.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="Apache Tomcat v7.0"/>
<fixed facet="wst.jsdt.web"/>
<installed facet="jst.web" version="2.5"/>
<installed facet="jst.jaxrs" version="2.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="java" version="1.7"/>
<installed facet="java" version="1.8"/>
</faceted-project>
3 changes: 3 additions & 0 deletions src/main/java/com/_37coins/bcJsonRpc/BitcoindInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ public interface BitcoindInterface {
//creates a raw transaction and returns its byte representations
public String sendrawtransaction(String rawTransaction);

// Returns array of unspent transaction outputs
public List<ListUnspentTO> listunspent(int minconf, int maxconf, List<String> addresses, boolean includeUnsafe, Map<String,String> queryOptions);

//Returns an object about the given transaction hash.
public String getrawtransaction(String hash);
//Returns an object about the given transaction hash.
Expand Down
89 changes: 89 additions & 0 deletions src/main/java/com/_37coins/bcJsonRpc/ListUnspentTO.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package com._37coins.bcJsonRpc;

import java.math.BigDecimal;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;

@JsonInclude(Include.NON_NULL)
//@JsonIgnoreProperties(ignoreUnknown=true)
public class ListUnspentTO {
String txid;
int vout;
String address;
String account;
String scriptPubKey;
BigDecimal amount;
int confirmations;
boolean spendable;
boolean solvable;
boolean safe;

public String getTxid() {
return txid;
}
public void setTxid(String txid) {
this.txid = txid;
}
public int getVout() {
return vout;
}
public void setVout(int vout) {
this.vout = vout;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getScriptPubKey() {
return scriptPubKey;
}
public void setScriptPubKey(String scriptPubKey) {
this.scriptPubKey = scriptPubKey;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public int getConfirmations() {
return confirmations;
}
public void setConfirmations(int confirmations) {
this.confirmations = confirmations;
}
public boolean isSpendable() {
return spendable;
}
public void setSpendable(boolean spendable) {
this.spendable = spendable;
}
public boolean isSolvable() {
return solvable;
}
public void setSolvable(boolean solvable) {
this.solvable = solvable;
}
public boolean isSafe() {
return safe;
}
public void setSafe(boolean safe) {
this.safe = safe;
}

@Override
public String toString() {
return "ListUnspentTO [txid=" + txid + ", vout=" + vout + ", address=" + address + ", account=" + account
+ ", scriptPubKey=" + scriptPubKey + ", amount=" + amount + ", confirmations=" + confirmations
+ ", spendable=" + spendable + ", solvable=" + solvable + ", safe=" + safe + "]";
}
}
4 changes: 3 additions & 1 deletion src/main/java/store/bitcoin/MemoryBlockStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void put(StoredBlock block) throws BlockStoreException {
updateChainHead(block);
}

StoredTransaction doubleTx;
StoredTransaction doubleTx; //TODO - Initialise doubleTx

/**
* Add a transaction to the addressTransaction map. If there is no entry for
Expand All @@ -80,6 +80,8 @@ void addAddressTransactions(String address, StoredTransaction tx) {
// it is added twice to the addressTransaction set. Thus this funny code below.
// otherwise only
// thisaddressTransactions.add(tx); would be needed.


final String debugStopAddress = "538185dd71bbbab9e2f8fb9da0c89c77f065393d92482629b4af940cb2bcc09a";
if (tx.getTxid().equals(debugStopAddress)) {
log.info("debugTx: set():{}", thisaddressTransactions);
Expand Down
Loading

0 comments on commit 0772f0e

Please sign in to comment.