Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upload file with muti token, and bt protocol #269

Merged
merged 40 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
deca3a6
feat: muti token upload_shard
turingczz Nov 15, 2022
30b35e0
feat: vault implementation upgrade
imstevez Nov 16, 2022
5acdb3a
feat: mod code incompent
turingczz Nov 16, 2022
3cdf0dc
chore: modify test vault logic contract address
imstevez Nov 17, 2022
e31f2c0
chore: vault incopenment
turingczz Nov 17, 2022
0a69e03
chore: vault incopenment, add muti func
turingczz Nov 17, 2022
f5df0e3
chore: mod cheque of muti
turingczz Nov 17, 2022
3daecb7
chore: mod tokon string to common.address
turingczz Nov 18, 2022
6d83965
chore: test
turingczz Nov 18, 2022
4264a3e
chore: test
turingczz Nov 18, 2022
d89b3a8
chore: debug muti token
turingczz Nov 18, 2022
5d15694
chore: debug cash cheque
turingczz Nov 18, 2022
e70f7d7
chore: debug price contract
turingczz Nov 18, 2022
f049033
chore: add token-type for more cmd
turingczz Nov 19, 2022
9ac02aa
feat: add support tokens
turingczz Nov 21, 2022
5388981
feat: add support tokens
turingczz Nov 21, 2022
c48949b
chore: add ChequeStatsAllCmd
turingczz Nov 21, 2022
5eb63d0
feat: mod receive_history_stats_all send-history-stats-all
turingczz Nov 21, 2022
3cf7901
test: other token upload ok
turingczz Nov 22, 2022
e60a0a1
chore: vault logic contract address
imstevez Nov 22, 2022
796a760
test: chequeRecordRet add token
turingczz Nov 22, 2022
b1d8bb5
test: send_history_list + send_history_peer
turingczz Nov 22, 2022
4345b94
test: LastCheques of one token
turingczz Nov 22, 2022
d8d4283
test: cheque recievelist
turingczz Nov 23, 2022
436d330
test: receive_history_list receive_history_peer receive_total_count
turingczz Nov 23, 2022
b549258
test: cash_list
turingczz Nov 23, 2022
285ed36
Merge remote-tracking branch 'origin/feature/vault_impl_upgrade' into…
turingczz Nov 23, 2022
89e7b49
test: receive_list_all send_list_all
turingczz Nov 23, 2022
120398f
test: cashout event
turingczz Nov 23, 2022
50e3ff4
test: muti token vault deposit
turingczz Nov 23, 2022
d26e2c7
feat: add bittorrent cmd (#265)
Shawn-Huang-Tron Nov 24, 2022
9387be6
test: balance of bttc, and transfer
turingczz Nov 24, 2022
ae7715e
Merge branch 'pre_v2.3.0_union_logic' into pre_v2.3.0_union
turingczz Nov 24, 2022
17250a9
feat[bittorrent]: listen port from 30000 to 31000 (#267)
Shawn-Huang-Tron Nov 25, 2022
61cfc9a
feat: add adds pin (#268)
Shawn-Huang-Tron Nov 25, 2022
35cd7a2
test: unit test
turingczz Nov 25, 2022
b186f14
test: receive_list_all update sort
turingczz Nov 25, 2022
3a90ad6
Merge branch 'pre_v2.3.0_union_logic' into pre_v2.3.0_union
turingczz Nov 25, 2022
eb2c693
test: mod token type
turingczz Nov 25, 2022
ccdaa09
Merge branch 'pre_v2.3.0_union_logic' into pre_v2.3.0_union
turingczz Nov 25, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,8 @@ cmd/.DS_Store
cmd/btfs/s
cmd/btfs/btfs
.DS_Store

cmd/btfs/btfs.upgrade
cmd/btfs/ttt
cmd/btfs/tt
cmd/btfs/t
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.16
FROM golang:1.18
MAINTAINER TRON-US <support@tron.network>

# Install deps
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.testing
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.15
FROM golang:1.18
MAINTAINER TRON-US <support@tron.network>

# Install deps
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.unit_testing
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.15
FROM golang:1.18
MAINTAINER TRON-US <support@tron.network>

# Dockerfile.unit_testing will build an image to run the go unit tests.
Expand Down
11 changes: 6 additions & 5 deletions accounting/accounting.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package accounting
import (
"context"
"fmt"
"github.com/ethereum/go-ethereum/common"
"math/big"
"sync"
"time"
Expand All @@ -20,7 +21,7 @@ import (
var log = logging.Logger("accounting")

// PayFunc is the function used for async monetary settlement
type PayFunc func(context.Context, string, *big.Int, string)
type PayFunc func(context.Context, string, *big.Int, string, common.Address)

// accountingPeer holds all in-memory accounting information for one peer.
type accountingPeer struct {
Expand Down Expand Up @@ -70,10 +71,10 @@ func (a *Accounting) Close() error {
}

// Settle to a peer. The lock on the accountingPeer must be held when called.
func (a *Accounting) Settle(toPeer string, paymentAmount *big.Int, contractId string) error {
func (a *Accounting) Settle(toPeer string, paymentAmount *big.Int, contractId string, token common.Address) error {
if paymentAmount.Cmp(a.minimumPayment) >= 0 {
a.wg.Add(1)
go a.payFunction(context.Background(), toPeer, paymentAmount, contractId)
go a.payFunction(context.Background(), toPeer, paymentAmount, contractId, token)
}

return nil
Expand All @@ -97,7 +98,7 @@ func (a *Accounting) getAccountingPeer(peer string) *accountingPeer {
}

// NotifyPaymentSent is triggered by async monetary settlement to update our balance and remove it's price from the shadow reserve
func (a *Accounting) NotifyPaymentSent(peer string, amount *big.Int, receivedError error) {
func (a *Accounting) NotifyPaymentSent(peer string, amount *big.Int, receivedError error, token common.Address) {
defer a.wg.Done()
accountingPeer := a.getAccountingPeer(peer)

Expand All @@ -114,7 +115,7 @@ func (a *Accounting) NotifyPaymentSent(peer string, amount *big.Int, receivedErr
}

// NotifyPayment is called by Settlement when we receive a payment.
func (a *Accounting) NotifyPaymentReceived(peer string, amount *big.Int) error {
func (a *Accounting) NotifyPaymentReceived(peer string, amount *big.Int, token common.Address) error {
accountingPeer := a.getAccountingPeer(peer)

accountingPeer.lock.Lock()
Expand Down
3 changes: 2 additions & 1 deletion assets/bindata_dep.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build never,!never
//go:build never && !never
// +build never,!never

package assets

Expand Down
Loading