mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 10:50:44 +00:00
all: fix whitespace (#1572)
This commit is contained in:
parent
aafcae3b28
commit
d20f91057a
21 changed files with 0 additions and 31 deletions
|
|
@ -10,5 +10,4 @@ func EncodeBytesItem(val interface{}) ([]byte, error) {
|
||||||
|
|
||||||
func DecodeBytesItem(bytes []byte, val interface{}) error {
|
func DecodeBytesItem(bytes []byte, val interface{}) error {
|
||||||
return rlp.DecodeBytes(bytes, val)
|
return rlp.DecodeBytes(bytes, val)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -396,7 +396,6 @@ func VerifyBalance(isXDCXLendingFork bool, statedb *state.StateDB, lendingStateD
|
||||||
return fmt.Errorf("VerifyBalance: not enough balance to process payment for lendingTrade."+
|
return fmt.Errorf("VerifyBalance: not enough balance to process payment for lendingTrade."+
|
||||||
"lendingTradeId: %v. Token: %s. ExpectedBalance: %s. ActualBalance: %s",
|
"lendingTradeId: %v. Token: %s. ExpectedBalance: %s. ActualBalance: %s",
|
||||||
lendingTradeId, lendingTrade.LendingToken.Hex(), paymentBalance.String(), tokenBalance.String())
|
lendingTradeId, lendingTrade.LendingToken.Hex(), paymentBalance.String(), tokenBalance.String())
|
||||||
|
|
||||||
}
|
}
|
||||||
case Market, Limit:
|
case Market, Limit:
|
||||||
switch side {
|
switch side {
|
||||||
|
|
@ -421,7 +420,6 @@ func VerifyBalance(isXDCXLendingFork bool, statedb *state.StateDB, lendingStateD
|
||||||
if defaultFeeInXDC.Cmp(common.RelayerLendingFee) <= 0 {
|
if defaultFeeInXDC.Cmp(common.RelayerLendingFee) <= 0 {
|
||||||
return ErrQuantityTradeTooSmall
|
return ErrQuantityTradeTooSmall
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case LendingStatusCancelled:
|
case LendingStatusCancelled:
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,6 @@ func GetSettleBalance(isXDCXLendingFork bool,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
collateralQuantity := new(big.Int).Mul(quantityToLend, collateralTokenDecimal)
|
collateralQuantity := new(big.Int).Mul(quantityToLend, collateralTokenDecimal)
|
||||||
collateralQuantity = new(big.Int).Mul(collateralQuantity, depositRate) // eg: depositRate = 150%
|
collateralQuantity = new(big.Int).Mul(collateralQuantity, depositRate) // eg: depositRate = 150%
|
||||||
collateralQuantity = new(big.Int).Div(collateralQuantity, big.NewInt(100))
|
collateralQuantity = new(big.Int).Div(collateralQuantity, big.NewInt(100))
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCalculateSignersVote(t *testing.T) {
|
func TestCalculateSignersVote(t *testing.T) {
|
||||||
|
|
||||||
info := make(map[string]SignerTypes)
|
info := make(map[string]SignerTypes)
|
||||||
votes := utils.NewPool()
|
votes := utils.NewPool()
|
||||||
masternodes := []common.Address{{1}, {2}, {3}}
|
masternodes := []common.Address{{1}, {2}, {3}}
|
||||||
|
|
@ -46,7 +45,6 @@ func TestCalculateSignersVote(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCalculateSignersTimeout(t *testing.T) {
|
func TestCalculateSignersTimeout(t *testing.T) {
|
||||||
|
|
||||||
info := make(map[string]SignerTypes)
|
info := make(map[string]SignerTypes)
|
||||||
timeouts := utils.NewPool()
|
timeouts := utils.NewPool()
|
||||||
masternodes := []common.Address{{1}, {2}, {3}}
|
masternodes := []common.Address{{1}, {2}, {3}}
|
||||||
|
|
|
||||||
|
|
@ -211,7 +211,6 @@ func (x *XDPoS_v2) initial(chain consensus.ChainReader, header *types.Header) er
|
||||||
// can not call processQC because round is equal to default
|
// can not call processQC because round is equal to default
|
||||||
x.currentRound = 1
|
x.currentRound = 1
|
||||||
x.highestQuorumCert = quorumCert
|
x.highestQuorumCert = quorumCert
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
log.Info("[initial] highest QC from current header")
|
log.Info("[initial] highest QC from current header")
|
||||||
quorumCert, _, _, err = x.getExtraFields(header)
|
quorumCert, _, _, err = x.getExtraFields(header)
|
||||||
|
|
@ -306,7 +305,6 @@ func (x *XDPoS_v2) YourTurn(chain consensus.ChainReader, parent *types.Header, s
|
||||||
// Prepare implements consensus.Engine, preparing all the consensus fields of the
|
// Prepare implements consensus.Engine, preparing all the consensus fields of the
|
||||||
// header for running the transactions on top.
|
// header for running the transactions on top.
|
||||||
func (x *XDPoS_v2) Prepare(chain consensus.ChainReader, header *types.Header) error {
|
func (x *XDPoS_v2) Prepare(chain consensus.ChainReader, header *types.Header) error {
|
||||||
|
|
||||||
x.lock.RLock()
|
x.lock.RLock()
|
||||||
currentRound := x.currentRound
|
currentRound := x.currentRound
|
||||||
highestQC := x.highestQuorumCert
|
highestQC := x.highestQuorumCert
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,6 @@ func (x *XDPoS_v2) GetEpochSwitchInfoBetween(chain consensus.ChainReader, begin,
|
||||||
if iteratorNum.Cmp(begin.Number) >= 0 {
|
if iteratorNum.Cmp(begin.Number) >= 0 {
|
||||||
infos = append(infos, epochSwitchInfo)
|
infos = append(infos, epochSwitchInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// reverse the array
|
// reverse the array
|
||||||
for i := 0; i < len(infos)/2; i++ {
|
for i := 0; i < len(infos)/2; i++ {
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,6 @@ func (x *XDPoS_v2) processSyncInfoPool(chain consensus.ChainReader) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *XDPoS_v2) verifySignatures(messageHash common.Hash, signatures []types.Signature, candidates []common.Address) error {
|
func (x *XDPoS_v2) verifySignatures(messageHash common.Hash, signatures []types.Signature, candidates []common.Address) error {
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
wg.Add(len(signatures))
|
wg.Add(len(signatures))
|
||||||
var haveError error
|
var haveError error
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,6 @@ func ecrecover(header *types.Header, sigcache *utils.SigLRU) (common.Address, er
|
||||||
|
|
||||||
sigcache.Add(hash, signer)
|
sigcache.Add(hash, signer)
|
||||||
return signer, nil
|
return signer, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get masternodes address from checkpoint Header. Only used for v1 last block
|
// Get masternodes address from checkpoint Header. Only used for v1 last block
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,6 @@ func RandStringBytes(n int) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func getCommonBackend(t *testing.T, chainConfig *params.ChainConfig) *backends.SimulatedBackend {
|
func getCommonBackend(t *testing.T, chainConfig *params.ChainConfig) *backends.SimulatedBackend {
|
||||||
|
|
||||||
// initial helper backend
|
// initial helper backend
|
||||||
contractBackendForSC := backends.NewXDCSimulatedBackend(types.GenesisAlloc{
|
contractBackendForSC := backends.NewXDCSimulatedBackend(types.GenesisAlloc{
|
||||||
voterAddr: {Balance: new(big.Int).SetUint64(10000000000)},
|
voterAddr: {Balance: new(big.Int).SetUint64(10000000000)},
|
||||||
|
|
|
||||||
|
|
@ -2917,7 +2917,6 @@ func (bc *BlockChain) logLendingData(block *types.Block) {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
for _, batch := range batches {
|
for _, batch := range batches {
|
||||||
|
|
||||||
dirtyOrderCount := uint64(0)
|
dirtyOrderCount := uint64(0)
|
||||||
for _, item := range batch.Data {
|
for _, item := range batch.Data {
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -873,7 +873,6 @@ func TestChainTxReorgs(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLogReorgs(t *testing.T) {
|
func TestLogReorgs(t *testing.T) {
|
||||||
|
|
||||||
var (
|
var (
|
||||||
key1, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
key1, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
||||||
addr1 = crypto.PubkeyToAddress(key1.PublicKey)
|
addr1 = crypto.PubkeyToAddress(key1.PublicKey)
|
||||||
|
|
@ -1436,7 +1435,6 @@ func benchmarkLargeNumberOfValueToNonexisting(b *testing.B, numTxs, numBlocks in
|
||||||
b.StopTimer()
|
b.StopTimer()
|
||||||
if got := chain.CurrentBlock().Transactions().Len(); got != numTxs*numBlocks {
|
if got := chain.CurrentBlock().Transactions().Len(); got != numTxs*numBlocks {
|
||||||
b.Fatalf("Transactions were not included, expected %d, got %d", (numTxs * numBlocks), got)
|
b.Fatalf("Transactions were not included, expected %d, got %d", (numTxs * numBlocks), got)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1577,7 +1575,6 @@ func TestAreTwoBlocksSamePath(t *testing.T) {
|
||||||
t.Error("Failed")
|
t.Error("Failed")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestEIP2718Transition tests that an EIP-2718 transaction will be accepted
|
// TestEIP2718Transition tests that an EIP-2718 transaction will be accepted
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,6 @@ func (tx *LendingTransaction) WithSignature(signer LendingSigner, sig []byte) (*
|
||||||
|
|
||||||
// ImportSignature make lending tx with specific signature
|
// ImportSignature make lending tx with specific signature
|
||||||
func (tx *LendingTransaction) ImportSignature(V, R, S *big.Int) *LendingTransaction {
|
func (tx *LendingTransaction) ImportSignature(V, R, S *big.Int) *LendingTransaction {
|
||||||
|
|
||||||
if V != nil {
|
if V != nil {
|
||||||
tx.data.V = V
|
tx.data.V = V
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,6 @@ func MarshalSignature(R, S, V *big.Int) ([]byte, error) {
|
||||||
|
|
||||||
// Sender get signer from
|
// Sender get signer from
|
||||||
func (ordersign OrderTxSigner) Sender(tx *OrderTransaction) (common.Address, error) {
|
func (ordersign OrderTxSigner) Sender(tx *OrderTransaction) (common.Address, error) {
|
||||||
|
|
||||||
message := crypto.Keccak256(
|
message := crypto.Keccak256(
|
||||||
[]byte("\x19Ethereum Signed Message:\n32"),
|
[]byte("\x19Ethereum Signed Message:\n32"),
|
||||||
ordersign.Hash(tx).Bytes(),
|
ordersign.Hash(tx).Bytes(),
|
||||||
|
|
|
||||||
|
|
@ -281,11 +281,9 @@ func TestInnerProductVerifyFastLen64Rand(t *testing.T) {
|
||||||
t.Error("Inner Product Proof incorrect")
|
t.Error("Inner Product Proof incorrect")
|
||||||
fmt.Printf("Values Used: \n\ta = %s\n\tb = %s\n", a, b)
|
fmt.Printf("Values Used: \n\ta = %s\n\tb = %s\n", a, b)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMRPProveZERO(t *testing.T) {
|
func TestMRPProveZERO(t *testing.T) {
|
||||||
|
|
||||||
mRangeProof, _ := MRPProve([]*big.Int{
|
mRangeProof, _ := MRPProve([]*big.Int{
|
||||||
new(big.Int).SetInt64(0),
|
new(big.Int).SetInt64(0),
|
||||||
})
|
})
|
||||||
|
|
@ -294,7 +292,6 @@ func TestMRPProveZERO(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMRPProve_MAX_2_POW_64(t *testing.T) {
|
func TestMRPProve_MAX_2_POW_64(t *testing.T) {
|
||||||
|
|
||||||
mRangeProof, _ := MRPProve([]*big.Int{
|
mRangeProof, _ := MRPProve([]*big.Int{
|
||||||
new(big.Int).SetUint64(0xFFFFFFFFFFFFFFFF),
|
new(big.Int).SetUint64(0xFFFFFFFFFFFFFFFF),
|
||||||
})
|
})
|
||||||
|
|
@ -303,7 +300,6 @@ func TestMRPProve_MAX_2_POW_64(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMRPProveOutOfSupportedRange(t *testing.T) {
|
func TestMRPProveOutOfSupportedRange(t *testing.T) {
|
||||||
|
|
||||||
value, _ := new(big.Int).SetString("FFFFFFFFFFFFFFFFFFFF", 16)
|
value, _ := new(big.Int).SetString("FFFFFFFFFFFFFFFFFFFF", 16)
|
||||||
_, err := MRPProve([]*big.Int{
|
_, err := MRPProve([]*big.Int{
|
||||||
value,
|
value,
|
||||||
|
|
@ -312,7 +308,6 @@ func TestMRPProveOutOfSupportedRange(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMRPProve_RANDOM(t *testing.T) {
|
func TestMRPProve_RANDOM(t *testing.T) {
|
||||||
|
|
||||||
mRangeProof, _ := MRPProve(Rand64Vector(1))
|
mRangeProof, _ := MRPProve(Rand64Vector(1))
|
||||||
mv := MRPVerify(&mRangeProof)
|
mv := MRPVerify(&mRangeProof)
|
||||||
assert.Equal(t, mv, true, " MRProof incorrect")
|
assert.Equal(t, mv, true, " MRProof incorrect")
|
||||||
|
|
@ -343,7 +338,6 @@ func Rand64Vector(l int) []*big.Int {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMRPProveValueNumberNotSupported(t *testing.T) {
|
func TestMRPProveValueNumberNotSupported(t *testing.T) {
|
||||||
|
|
||||||
_, err := MRPProve(Rand64Vector(3))
|
_, err := MRPProve(Rand64Vector(3))
|
||||||
assert.NotNil(t, err, "MRProof incorrect - accepted 3 inputs")
|
assert.NotNil(t, err, "MRProof incorrect - accepted 3 inputs")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -312,7 +312,6 @@ func TestDatabaseSuite(t *testing.T, New func() ethdb.KeyValueStore) {
|
||||||
t.Errorf("got: %s; want: %s", got, want)
|
t.Errorf("got: %s; want: %s", got, want)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func iterateKeys(it ethdb.Iterator) []string {
|
func iterateKeys(it ethdb.Iterator) []string {
|
||||||
|
|
|
||||||
|
|
@ -2071,7 +2071,6 @@ func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (c
|
||||||
|
|
||||||
// SubmitTransaction is a helper function that submits tx to txPool and logs a message.
|
// SubmitTransaction is a helper function that submits tx to txPool and logs a message.
|
||||||
func submitOrderTransaction(ctx context.Context, b Backend, tx *types.OrderTransaction) (common.Hash, error) {
|
func submitOrderTransaction(ctx context.Context, b Backend, tx *types.OrderTransaction) (common.Hash, error) {
|
||||||
|
|
||||||
if err := b.SendOrderTx(ctx, tx); err != nil {
|
if err := b.SendOrderTx(ctx, tx); err != nil {
|
||||||
return common.Hash{}, err
|
return common.Hash{}, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -219,7 +219,6 @@ func (ctx ppctx) fields(obj *goja.Object) []string {
|
||||||
vals = append(vals, k)
|
vals = append(vals, k)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
iterOwnAndConstructorKeys(ctx.vm, obj, add)
|
iterOwnAndConstructorKeys(ctx.vm, obj, add)
|
||||||
sort.Strings(vals)
|
sort.Strings(vals)
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,6 @@ func (t *rlpx) close(err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *rlpx) doProtoHandshake(our *protoHandshake) (their *protoHandshake, err error) {
|
func (t *rlpx) doProtoHandshake(our *protoHandshake) (their *protoHandshake, err error) {
|
||||||
|
|
||||||
// Writing our handshake happens concurrently, we prefer
|
// Writing our handshake happens concurrently, we prefer
|
||||||
// returning the handshake read error. If the remote side
|
// returning the handshake read error. If the remote side
|
||||||
// disconnects us early with a valid reason, we should return it
|
// disconnects us early with a valid reason, we should return it
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,6 @@ func (sn *SimNode) Start(snapshots map[string][]byte) error {
|
||||||
serviceFunc := sn.adapter.lifecycles[name]
|
serviceFunc := sn.adapter.lifecycles[name]
|
||||||
service, err := serviceFunc(ctx, sn.node)
|
service, err := serviceFunc(ctx, sn.node)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
||||||
regErr = err
|
regErr = err
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,6 @@ func main() {
|
||||||
var adapter adapters.NodeAdapter
|
var adapter adapters.NodeAdapter
|
||||||
|
|
||||||
switch *adapterType {
|
switch *adapterType {
|
||||||
|
|
||||||
case "sim":
|
case "sim":
|
||||||
log.Info("using sim adapter")
|
log.Info("using sim adapter")
|
||||||
adapter = adapters.NewSimAdapter(services)
|
adapter = adapters.NewSimAdapter(services)
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,6 @@ func (net *Network) watchPeerEvents(id discover.NodeID, events chan *p2p.PeerEve
|
||||||
}
|
}
|
||||||
peer := event.Peer
|
peer := event.Peer
|
||||||
switch event.Type {
|
switch event.Type {
|
||||||
|
|
||||||
case p2p.PeerEventTypeAdd:
|
case p2p.PeerEventTypeAdd:
|
||||||
net.DidConnect(id, peer)
|
net.DidConnect(id, peer)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue