Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Testing first stratum function - getAddressInfo
- Loading branch information
Showing
8 changed files
with
97 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.bitcoinpotato.util; | ||
|
||
public interface Func2<TArg1, TArg2, TResult> { | ||
TResult apply(TArg1 arg1, TArg2 arg2); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.bitcoinpotato.util; | ||
|
||
import com.google.common.base.Function; | ||
|
||
import java.util.Map; | ||
|
||
import static com.google.common.base.Preconditions.checkArgument; | ||
import static com.google.common.collect.Maps.newHashMap; | ||
|
||
public class Maps3 { | ||
public static <K, V> Map<K, V> build(Iterable<K> keys, Function<K, V> buildValue) { | ||
Map<K, V> result = newHashMap(); | ||
for (K key : keys) { | ||
checkArgument(!result.containsKey(key)); | ||
V value = buildValue.apply(key); | ||
result.put(key, value); | ||
} | ||
return result; | ||
} | ||
|
||
public static <K, V1, V2> Map<K, V2> build(Map<K, V1> input, Func2<K, V1, V2> buildValue) { | ||
Map<K, V2> result = newHashMap(); | ||
for (Map.Entry<K, V1> entry : input.entrySet()) { | ||
checkArgument(!result.containsKey(entry.getKey())); | ||
K key = entry.getKey(); | ||
V1 value1 = entry.getValue(); | ||
V2 value = buildValue.apply(key, value1); | ||
result.put(key, value); | ||
} | ||
return result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.bitcoin.stratum; | ||
|
||
import com.google.bitcoin.core.NetworkParameters; | ||
import org.junit.Test; | ||
import play.test.UnitTest; | ||
|
||
public class StratumTests extends UnitTest { | ||
@Test | ||
public void sanity() { | ||
Stratum stratum = new Stratum(NetworkParameters.testNet(), "http://chicago.stratum.bitcoin.cz:8000/"); | ||
String someTestnetAddress = "mw5h6BDh77GUPc4DCmzjoU7ry2R4exoaYr"; | ||
|
||
AddressInfo addressInfo = stratum.getAddressInfo(someTestnetAddress); | ||
|
||
System.out.println("Foobar"); | ||
} | ||
} |