func (sts *SimpleTxnSubmitter) clientToServerTxn(clientTxnCap *cmsgs.ClientTxn, topologyVersion uint32) (*msgs.Txn, []common.RMId, []common.RMId, error) { outgoingSeg := capn.NewBuffer(nil) txnCap := msgs.NewTxn(outgoingSeg) txnCap.SetId(clientTxnCap.Id()) txnCap.SetRetry(clientTxnCap.Retry()) txnCap.SetSubmitter(uint32(sts.rmId)) txnCap.SetSubmitterBootCount(sts.bootCount) txnCap.SetFInc(sts.topology.FInc) txnCap.SetTopologyVersion(topologyVersion) clientActions := clientTxnCap.Actions() actions := msgs.NewActionList(outgoingSeg, clientActions.Len()) txnCap.SetActions(actions) picker := ch.NewCombinationPicker(int(sts.topology.FInc), sts.disabledHashCodes) rmIdToActionIndices, err := sts.translateActions(outgoingSeg, picker, &actions, &clientActions) if err != nil { return nil, nil, nil, err } // NB: we're guaranteed that activeRMs and passiveRMs are // disjoint. Thus there is no RM that has some active and some // passive actions. activeRMs, passiveRMs, err := picker.Choose() if err != nil { return nil, nil, nil, err } allocations := msgs.NewAllocationList(outgoingSeg, len(activeRMs)+len(passiveRMs)) txnCap.SetAllocations(allocations) sts.setAllocations(0, rmIdToActionIndices, &allocations, outgoingSeg, true, activeRMs) sts.setAllocations(len(activeRMs), rmIdToActionIndices, &allocations, outgoingSeg, false, passiveRMs) return &txnCap, activeRMs, passiveRMs, nil }