Skip to content
This repository has been archived by the owner on Apr 3, 2022. It is now read-only.

Commit

Permalink
Version 2.1.2-0.alpha.atlantis+28092018
Browse files Browse the repository at this point in the history
  • Loading branch information
Captain Dero committed Sep 28, 2018
1 parent ed2cd30 commit 813c580
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 17 deletions.
2 changes: 1 addition & 1 deletion config/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ import "github.com/blang/semver"

// right now it has to be manually changed
// do we need to include git commitsha??
var Version = semver.MustParse("2.1.0-0.alpha.atlantis+19092018")
var Version = semver.MustParse("2.1.2-0.alpha.atlantis+28092018")
60 changes: 44 additions & 16 deletions walletapi/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ func (w *Wallet) GetSeedinLanguage(lang string) (str string) {
return mnemonics.Key_To_Words(w.account.Keys.Spendkey_Secret, lang)
}


// view wallet key consists of public spendkey and private view key
func (w *Wallet) GetViewWalletKey() (str string) {
return fmt.Sprintf("%s%s", w.account.Keys.Spendkey_Public, w.account.Keys.Viewkey_Secret)
Expand Down Expand Up @@ -428,6 +427,36 @@ func (w *Wallet) Add_Transaction_Record_Funds(txdata *globals.TX_Output_Data) (a
tx_wallet.WKimage = kimage
tx_wallet.WKey.Destination = secret_key

if w.check_key_exists(BLOCKCHAIN_UNIVERSE, []byte(KEYIMAGE_BUCKET), kimage[:]) {
// find the output index to which this key image belong
value_bytes, err := w.load_key_value(BLOCKCHAIN_UNIVERSE, []byte(KEYIMAGE_BUCKET), kimage[:])
if err != nil {
panic(fmt.Sprintf("Error while reading keyimage data key_image %s, err %s", kimage, err))
}
index := binary.BigEndian.Uint64(value_bytes)

// now lets load the suitable index data
value_bytes, err = w.load_key_value(BLOCKCHAIN_UNIVERSE, []byte(FUNDS_BUCKET), itob(index))
if err != nil {
panic(fmt.Sprintf("Error while reading funds data key_image %s, index %d err %s", kimage, index, err))
}

var tx_wallet_temp TX_Wallet_Data
err = msgpack.Unmarshal(value_bytes, &tx_wallet_temp)
if err != nil {
panic(fmt.Sprintf("Error while decoding funds data key_image %s, index %d err %s", kimage, index, err))
}

if tx_wallet_temp.TXdata.TXID != txdata.TXID { // transaction mismatch
return 0, false
}

if tx_wallet_temp.TXdata.Index_within_tx != txdata.Index_within_tx { // index within tx mismatch
return 0, false
}

}

// store the key image so as later on we can find when it is spent
w.store_key_value(BLOCKCHAIN_UNIVERSE, []byte(KEYIMAGE_BUCKET), kimage[:], itob(txdata.Index_Global))
}
Expand Down Expand Up @@ -701,8 +730,8 @@ type Entry struct {
// if payment_id is true, only entries with payment ids are returned
func (w *Wallet) Show_Transfers(available bool, in bool, out bool, pool bool, failed bool, payment_id bool, min_height, max_height uint64) (entries []Entry) {

dero_first_block_time := time.Unix(1512432000,0) //Tuesday, December 5, 2017 12:00:00 AM
dero_first_block_time := time.Unix(1512432000, 0) //Tuesday, December 5, 2017 12:00:00 AM

if max_height == 0 {
max_height = 5000000000
}
Expand Down Expand Up @@ -730,8 +759,8 @@ func (w *Wallet) Show_Transfers(available bool, in bool, out bool, pool bool, fa
entry.Time = time.Unix(int64(tx.TXdata.Block_Time), 0)

if entry.Height < 95600 { // make up time for pre-atlantis blocks
duration,_ := time.ParseDuration(fmt.Sprintf("%ds",int64(180*entry.Height)))
entry.Time = dero_first_block_time.Add(duration)
duration, _ := time.ParseDuration(fmt.Sprintf("%ds", int64(180*entry.Height)))
entry.Time = dero_first_block_time.Add(duration)
}

if payment_id {
Expand Down Expand Up @@ -773,9 +802,9 @@ func (w *Wallet) Show_Transfers(available bool, in bool, out bool, pool bool, fa
entry.Time = time.Unix(int64(tx.TXdata.Block_Time), 0)

if entry.Height < 95600 { // make up time for pre-atlantis blocks
duration,_ := time.ParseDuration(fmt.Sprintf("%ds",int64(180*entry.Height)))
entry.Time = dero_first_block_time.Add(duration)
}
duration, _ := time.ParseDuration(fmt.Sprintf("%ds", int64(180*entry.Height)))
entry.Time = dero_first_block_time.Add(duration)
}

if in {
if tx.TXdata.Height >= min_height && tx.TXdata.Height <= max_height { // height filter
Expand Down Expand Up @@ -813,7 +842,7 @@ func (w *Wallet) Show_Transfers(available bool, in bool, out bool, pool bool, fa
entry.Time = time.Unix(int64(tx.TXdata.Block_Time), 0)

if entry.Height < 95600 { // make up time for pre-atlantis blocks
duration,_ := time.ParseDuration(fmt.Sprintf("%ds",int64(180*entry.Height)))
duration, _ := time.ParseDuration(fmt.Sprintf("%ds", int64(180*entry.Height)))
entry.Time = dero_first_block_time.Add(duration)
}

Expand Down Expand Up @@ -1127,18 +1156,17 @@ func (w *Wallet) GetTXKey(txhash crypto.Hash) string {
return fmt.Sprintf("%x", key)
}


// we need better names for functions
func (w *Wallet) GetTXOutDetails(txhash crypto.Hash) ( details structures.Outgoing_Transfer_Details) {
func (w *Wallet) GetTXOutDetails(txhash crypto.Hash) (details structures.Outgoing_Transfer_Details) {

data_bytes, err := w.load_key_value(BLOCKCHAIN_UNIVERSE, []byte(TX_OUT_DETAILS_BUCKET), txhash[:])
if err != nil {
return
return
}

if len(data_bytes) > 10 {
json.Unmarshal(data_bytes,&details)
}
json.Unmarshal(data_bytes, &details)
}

return
return
}

0 comments on commit 813c580

Please sign in to comment.