Skip to content

Commit

Permalink
Pre release (#20)
Browse files Browse the repository at this point in the history
* Sign executables on deploy

* Use human readable version of addresses in bloom filters.

* Make sure transactions and addresses are always updated
  • Loading branch information
anchaj authored and meyer9 committed May 23, 2019
1 parent 02b5ced commit 4637ae9
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
6 changes: 3 additions & 3 deletions bitcoin/phored/datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ func (ts *TxStore) GimmeFilter() (*bloom.Filter, error) {
}
ts.addrMutex.Lock()
elem := uint32(len(ts.adrs)+len(allUtxos)+len(allStxos)) + uint32(len(ts.watchedScripts))
f := bloom.NewFilter(elem, 0, 0.00003, wire.BloomUpdateAll)
f := bloom.NewFilter(elem, 0, 0.001, wire.BloomUpdateAll)

// note there could be false positives since we're just looking
// for the 20 byte PKH without the opcodes.
for _, a := range ts.adrs { // add 20-byte pubkeyhash
f.Add(a.ScriptAddress())
f.Add([]byte(a.EncodeAddress()))
log.Debugf("bloom filter - watching for addr %s\n", a.String())
}
ts.addrMutex.Unlock()
Expand All @@ -94,7 +94,7 @@ func (ts *TxStore) GimmeFilter() (*bloom.Filter, error) {
continue
}
log.Debugf("bloom filter - watching for addrs %s from script (class - %s)", addrs, scriptClass.String())
f.Add(addrs[0].ScriptAddress())
f.Add([]byte(addrs[0].EncodeAddress()))
}

return f, nil
Expand Down
3 changes: 3 additions & 0 deletions bitcoin/phored/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ func startNotificationListener(wallet *RPCWallet) (*NotificationListener, error)
if err != nil {
log.Errorf("Reconnection failed. %s", err)
}
// if disconnected try to download transactions again and subscribe to bloom
wallet.RetrieveTransactions()
notificationListener.updateFilterAndSend()
}
}
}()
Expand Down
9 changes: 6 additions & 3 deletions bitcoin/phored/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func (w *RPCWallet) ChildKey(keyBytes []byte, chaincode []byte, isPrivateKey boo
return hdKey.Child(0)
}

// Mnemonic returns the mnemonis used to generate the wallet
// Mnemonic returns the mnemonic used to generate the wallet
func (w *RPCWallet) Mnemonic() string {
return w.mnemonic
}
Expand Down Expand Up @@ -494,8 +494,11 @@ func (w *RPCWallet) addWatchedScript(addr btc.Address) error {

// ReSyncBlockchain resyncs the addresses used by the SPV wallet
func (w *RPCWallet) ReSyncBlockchain(fromDate time.Time) {
w.txstore.PopulateAdrs()
w.RetrieveTransactions()
if w.started {
w.txstore.PopulateAdrs()
w.RetrieveTransactions()
w.notifications.updateFilterAndSend()
}
}

// Close closes the rpc wallet connection
Expand Down
15 changes: 15 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ if [ ! -z "$TRAVIS_TAG" ] &&
cp ../.travis/win32/libwinpthread-1.dll libwinpthread-1.win32.dll
cp ../.travis/win64/libwinpthread-1.dll libwinpthread-1.win64.dll

# Calculate SHA512 hashes
sha512sum * > sha512_checksums.txt

# Load signing key
cp ../.travis/sign.key.gpg /tmp
gpg --yes --batch --passphrase=$GPG_PASS /tmp/sign.key.gpg
gpg --allow-secret-key-import --import /tmp/sign.key.gpg
rm /tmp/sign.key.gpg

# Sign hash file
gpg --clearsign --digest-algo SHA512 --armor --output sha512_checksums.asc --passphrase=$GPG_PASS --default-key $GPG_KEYID sha512_checksums.txt

rm sha512_checksums.txt


# Upload to GitHub Release page
ghr --username phoreproject -t $GITHUB_TOKEN --replace --prerelease --debug $TRAVIS_TAG .
else
Expand Down

0 comments on commit 4637ae9

Please sign in to comment.