Skip to content

Commit

Permalink
testnet correction
Browse files Browse the repository at this point in the history
  • Loading branch information
furszy committed Dec 11, 2017
2 parents fddd692 + e067f21 commit ec100ff
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
16 changes: 5 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
[![Build Status](https://travis-ci.org/bitcoinj/bitcoinj.png?branch=master)](https://travis-ci.org/bitcoinj/bitcoinj) [![Coverage Status](https://coveralls.io/repos/bitcoinj/bitcoinj/badge.png?branch=master)](https://coveralls.io/r/bitcoinj/bitcoinj?branch=master)
### Welcome to pivxj

[![Visit our IRC channel](https://kiwiirc.com/buttons/irc.freenode.net/bitcoinj.png)](https://kiwiirc.com/client/irc.freenode.net/bitcoinj)

### Welcome to bitcoinj

The bitcoinj library is a Java implementation of the Bitcoin protocol, which allows it to maintain a wallet and send/receive transactions without needing a local copy of Bitcoin Core. It comes with full documentation and some example apps showing how to use it.
The pivxj library is a Java implementation of the PIVX protocol, which allows it to maintain a wallet and send/receive transactions without needing a local copy of PIVX Core. It comes with full documentation and some example apps showing how to use it.

### Technologies

Expand Down Expand Up @@ -41,18 +37,16 @@ These are found in the `examples` module.

#### Forwarding service

This will download the block chain and eventually print a Bitcoin address that it has generated.
This will download the block chain and eventually print a PIVX address that it has generated.

If you send coins to that address, it will forward them on to the address you specified.

```
cd examples
mvn exec:java -Dexec.mainClass=org.pivxj.examples.ForwardingService -Dexec.args="<insert a bitcoin address here>"
mvn exec:java -Dexec.mainClass=org.pivxj.examples.ForwardingService -Dexec.args="<insert a pivx address here>"
```

Note that this example app *does not use checkpointing*, so the initial chain sync will be pretty slow. You can make an app that starts up and does the initial sync much faster by including a checkpoints file; see the documentation for
more info on this technique.

### Where next?

Now you are ready to [follow the tutorial](https://bitcoinj.github.io/getting-started).
2 changes: 1 addition & 1 deletion core/src/main/java/org/pivxj/core/Block.java
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ protected void parse() throws ProtocolException {
nonce = readUint32();
//System.out.println("parse nonce: "+nonce);
int headerSize = getHeaderSize();
if (isZerocoin()) {
if (isZerocoin() && length >= ZEROCOIN_HEADER_SIZE) {
// accumulator
zeroCoinAccumulator = readHash(true);
//System.out.println("parse zeroCoinAccumulator: "+zeroCoinAccumulator);
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/org/pivxj/core/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ protected long readVarInt(int offset) throws ProtocolException {

protected byte[] readBytes(int length) throws ProtocolException {
if (length > MAX_SIZE) {
log.info("MAx size "+MAX_SIZE);
log.info("Max size "+MAX_SIZE);
throw new ProtocolException("Claimed value length too large: " + length);
}
try {
Expand Down
5 changes: 4 additions & 1 deletion core/src/main/java/org/pivxj/store/LevelDBBlockStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public synchronized void put(StoredBlock block) throws BlockStoreException {
//System.out.println("### block hash to save: "+blockHash.toString());
byte[] hash = blockHash.getBytes();
byte[] dbBuffer = buffer.array();

db.put(hash, dbBuffer);
// just for now to check something:
StoredBlock dbBlock = get(Sha256Hash.wrap(hash));
Expand All @@ -96,7 +97,9 @@ public synchronized void put(StoredBlock block) throws BlockStoreException {

assert Arrays.equals(dbBuffer,bufferTwo):"database is shit..";

assert Arrays.equals(dbBlock.getHeader().getHash().getBytes(),hash): "put is different than get in db.. "+block.getHeader().getHashAsString()+", db: "+dbBlock.getHeader().getHashAsString();
if (!Arrays.equals(dbBlock.getHeader().getHash().getBytes(),hash)) {
assert false : "put is different than get in db.. " + block.getHeader().getHashAsString() + ", db: " + dbBlock.getHeader().getHashAsString();
}
}

@Override @Nullable
Expand Down

0 comments on commit ec100ff

Please sign in to comment.