-
Notifications
You must be signed in to change notification settings - Fork 45
/
wallet_bundle.go
37 lines (32 loc) · 1.21 KB
/
wallet_bundle.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package goar
import (
"context"
"errors"
"github.com/everFinance/goar/types"
"os"
)
func (w *Wallet) SendBundleTxSpeedUp(ctx context.Context, concurrentNum int, bundleBinary interface{}, tags []types.Tag, txSpeed int64) (types.Transaction, error) {
bundleTags := []types.Tag{
{Name: "Bundle-Format", Value: "binary"},
{Name: "Bundle-Version", Value: "2.0.0"},
}
// check tags cannot include bundleTags Name
mmap := map[string]struct{}{
"Bundle-Format": {},
"Bundle-Version": {},
}
for _, tag := range tags {
if _, ok := mmap[tag.Name]; ok {
return types.Transaction{}, errors.New("tags can not set bundleTags")
}
}
txTags := make([]types.Tag, 0)
txTags = append(bundleTags, tags...)
return w.SendDataConcurrentSpeedUp(ctx, concurrentNum, bundleBinary, txTags, txSpeed)
}
func (w *Wallet) SendBundleTx(ctx context.Context, concurrentNum int, bundleBinary []byte, tags []types.Tag) (types.Transaction, error) {
return w.SendBundleTxSpeedUp(ctx, concurrentNum, bundleBinary, tags, 0)
}
func (w *Wallet) SendBundleTxStream(ctx context.Context, concurrentNum int, bundleReader *os.File, tags []types.Tag) (types.Transaction, error) {
return w.SendBundleTxSpeedUp(ctx, concurrentNum, bundleReader, tags, 0)
}